<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>web2py.gluon.scheduler</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="web2py.gluon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://www.web2py.com">web2py Web Framework</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;web2py ::
        <a href="web2py.gluon-module.html">Package&nbsp;gluon</a> ::
        Module&nbsp;scheduler
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="web2py.gluon.scheduler-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="web2py.gluon.scheduler-module.html">Module web2py.gluon.scheduler</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment">#### WORK IN PROGRESS... NOT SUPPOSED TO WORK YET</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt id="link-0" class="py-name" targets="Variable web2py.gluon.scheduler.USAGE=web2py.gluon.scheduler-module.html#USAGE"><a title="web2py.gluon.scheduler.USAGE" class="py-name" href="#" onclick="return doclink('link-0', 'USAGE', 'link-0');">USAGE</a></tt> <tt class="py-op">=</tt> <tt class="py-docstring">"""</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-docstring">## Example</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-docstring">For any existing app</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-docstring">Create File: app/models/scheduler.py ======</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-docstring">from gluon.scheduler import Scheduler</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-docstring">def demo1(*args,**vars):</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-docstring">    print 'you passed args=%s and vars=%s' % (args, vars)</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-docstring">    return 'done!'</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-docstring">def demo2():</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-docstring">    1/0</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-docstring">scheduler = Scheduler(db,dict(demo1=demo1,demo2=demo2))</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring">## run worker nodes with:</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">   cd web2py</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-docstring">   python gluon/scheduler.py -u sqlite://storage.sqlite \</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-docstring">                             -f applications/myapp/databases/ \</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring">                             -t mytasks.py</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-docstring">(-h for info)</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-docstring">python scheduler.py -h</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring">## schedule jobs using</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring">http://127.0.0.1:8000/scheduler/appadmin/insert/db/scheduler_task</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">## monitor scheduled jobs</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-docstring">http://127.0.0.1:8000/scheduler/appadmin/select/db?query=db.scheduler_task.id&gt;0</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-docstring">## view completed jobs</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt class="py-docstring">http://127.0.0.1:8000/scheduler/appadmin/select/db?query=db.scheduler_run.id&gt;0</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"><tt class="py-docstring">## view workers</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"><tt class="py-docstring">http://127.0.0.1:8000/scheduler/appadmin/select/db?query=db.scheduler_worker.id&gt;0</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-docstring">## Comments</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">os</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-1" class="py-name" targets="Class datetime.time=datetime.time-class.html"><a title="datetime.time" class="py-name" href="#" onclick="return doclink('link-1', 'time', 'link-1');">time</a></tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">multiprocessing</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">cStringIO</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">threading</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">traceback</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">signal</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Variable web2py.gluon.rocket.Connection.socket=web2py.gluon.rocket.Connection-class.html#socket"><a title="web2py.gluon.rocket.Connection.socket" class="py-name" href="#" onclick="return doclink('link-2', 'socket', 'link-2');">socket</a></tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-3" class="py-name" targets="Class datetime.datetime=datetime.datetime-class.html"><a title="datetime.datetime" class="py-name" href="#" onclick="return doclink('link-3', 'datetime', 'link-3');">datetime</a></tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">logging</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">optparse</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">    <tt class="py-keyword">from</tt> <tt id="link-4" class="py-name" targets="Package web2py.gluon=web2py.gluon-module.html"><a title="web2py.gluon" class="py-name" href="#" onclick="return doclink('link-4', 'gluon', 'link-4');">gluon</a></tt><tt class="py-op">.</tt><tt class="py-name">contrib</tt><tt class="py-op">.</tt><tt class="py-name">simplejson</tt> <tt class="py-keyword">import</tt> <tt class="py-name">loads</tt><tt class="py-op">,</tt> <tt class="py-name">dumps</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line"><tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">    <tt class="py-keyword">from</tt> <tt class="py-name">simplejson</tt> <tt class="py-keyword">import</tt> <tt class="py-name">loads</tt><tt class="py-op">,</tt> <tt class="py-name">dumps</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-string">'WEB2PY_PATH'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">environ</tt><tt class="py-op">:</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line">    <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-5" class="py-name" targets="Method web2py.gluon.html.DIV.append()=web2py.gluon.html.DIV-class.html#append,Method web2py.gluon.template.BlockNode.append()=web2py.gluon.template.BlockNode-class.html#append,Method web2py.gluon.template.Content.append()=web2py.gluon.template.Content-class.html#append"><a title="web2py.gluon.html.DIV.append
web2py.gluon.template.BlockNode.append
web2py.gluon.template.Content.append" class="py-name" href="#" onclick="return doclink('link-5', 'append', 'link-5');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">environ</tt><tt class="py-op">[</tt><tt class="py-string">'WEB2PY_PATH'</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"><tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">    <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">environ</tt><tt class="py-op">[</tt><tt class="py-string">'WEB2PY_PATH'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">getcwd</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line"> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-6" class="py-name"><a title="web2py.gluon" class="py-name" href="#" onclick="return doclink('link-6', 'gluon', 'link-4');">gluon</a></tt> <tt class="py-keyword">import</tt> <tt id="link-7" class="py-name" targets="Class web2py.gluon.dal.DAL=web2py.gluon.dal.DAL-class.html"><a title="web2py.gluon.dal.DAL" class="py-name" href="#" onclick="return doclink('link-7', 'DAL', 'link-7');">DAL</a></tt><tt class="py-op">,</tt> <tt id="link-8" class="py-name" targets="Class web2py.gluon.dal.Field=web2py.gluon.dal.Field-class.html"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-8', 'Field', 'link-8');">Field</a></tt><tt class="py-op">,</tt> <tt id="link-9" class="py-name" targets="Class web2py.gluon.validators.IS_NOT_EMPTY=web2py.gluon.validators.IS_NOT_EMPTY-class.html"><a title="web2py.gluon.validators.IS_NOT_EMPTY" class="py-name" href="#" onclick="return doclink('link-9', 'IS_NOT_EMPTY', 'link-9');">IS_NOT_EMPTY</a></tt><tt class="py-op">,</tt> <tt id="link-10" class="py-name" targets="Class web2py.gluon.validators.IS_IN_SET=web2py.gluon.validators.IS_IN_SET-class.html"><a title="web2py.gluon.validators.IS_IN_SET" class="py-name" href="#" onclick="return doclink('link-10', 'IS_IN_SET', 'link-10');">IS_IN_SET</a></tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-11" class="py-name"><a title="web2py.gluon" class="py-name" href="#" onclick="return doclink('link-11', 'gluon', 'link-4');">gluon</a></tt><tt class="py-op">.</tt><tt id="link-12" class="py-name" targets="Module web2py.gluon.utils=web2py.gluon.utils-module.html"><a title="web2py.gluon.utils" class="py-name" href="#" onclick="return doclink('link-12', 'utils', 'link-12');">utils</a></tt> <tt class="py-keyword">import</tt> <tt id="link-13" class="py-name" targets="Function web2py.gluon.utils.web2py_uuid()=web2py.gluon.utils-module.html#web2py_uuid"><a title="web2py.gluon.utils.web2py_uuid" class="py-name" href="#" onclick="return doclink('link-13', 'web2py_uuid', 'link-13');">web2py_uuid</a></tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line"> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line"><tt id="link-14" class="py-name" targets="Variable web2py.gluon.scheduler.QUEUED=web2py.gluon.scheduler-module.html#QUEUED"><a title="web2py.gluon.scheduler.QUEUED" class="py-name" href="#" onclick="return doclink('link-14', 'QUEUED', 'link-14');">QUEUED</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'QUEUED'</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line"><tt id="link-15" class="py-name" targets="Variable web2py.gluon.scheduler.ASSIGNED=web2py.gluon.scheduler-module.html#ASSIGNED"><a title="web2py.gluon.scheduler.ASSIGNED" class="py-name" href="#" onclick="return doclink('link-15', 'ASSIGNED', 'link-15');">ASSIGNED</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'ASSIGNED'</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"><tt id="link-16" class="py-name" targets="Variable web2py.gluon.scheduler.RUNNING=web2py.gluon.scheduler-module.html#RUNNING"><a title="web2py.gluon.scheduler.RUNNING" class="py-name" href="#" onclick="return doclink('link-16', 'RUNNING', 'link-16');">RUNNING</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'RUNNING'</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt id="link-17" class="py-name" targets="Variable web2py.gluon.scheduler.COMPLETED=web2py.gluon.scheduler-module.html#COMPLETED"><a title="web2py.gluon.scheduler.COMPLETED" class="py-name" href="#" onclick="return doclink('link-17', 'COMPLETED', 'link-17');">COMPLETED</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'COMPLETED'</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt id="link-18" class="py-name" targets="Variable web2py.gluon.scheduler.FAILED=web2py.gluon.scheduler-module.html#FAILED"><a title="web2py.gluon.scheduler.FAILED" class="py-name" href="#" onclick="return doclink('link-18', 'FAILED', 'link-18');">FAILED</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'FAILED'</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt id="link-19" class="py-name" targets="Variable web2py.gluon.scheduler.TIMEOUT=web2py.gluon.scheduler-module.html#TIMEOUT"><a title="web2py.gluon.scheduler.TIMEOUT" class="py-name" href="#" onclick="return doclink('link-19', 'TIMEOUT', 'link-19');">TIMEOUT</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'TIMEOUT'</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line"><tt id="link-20" class="py-name" targets="Variable web2py.gluon.scheduler.STOPPED=web2py.gluon.scheduler-module.html#STOPPED"><a title="web2py.gluon.scheduler.STOPPED" class="py-name" href="#" onclick="return doclink('link-20', 'STOPPED', 'link-20');">STOPPED</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'STOPPED'</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"><tt id="link-21" class="py-name" targets="Variable web2py.gluon.scheduler.ACTIVE=web2py.gluon.scheduler-module.html#ACTIVE"><a title="web2py.gluon.scheduler.ACTIVE" class="py-name" href="#" onclick="return doclink('link-21', 'ACTIVE', 'link-21');">ACTIVE</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'ACTIVE'</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line"><tt id="link-22" class="py-name" targets="Variable web2py.gluon.scheduler.INACTIVE=web2py.gluon.scheduler-module.html#INACTIVE"><a title="web2py.gluon.scheduler.INACTIVE" class="py-name" href="#" onclick="return doclink('link-22', 'INACTIVE', 'link-22');">INACTIVE</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'INACTIVE'</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"><tt id="link-23" class="py-name" targets="Variable web2py.gluon.scheduler.DISABLED=web2py.gluon.scheduler-module.html#DISABLED"><a title="web2py.gluon.scheduler.DISABLED" class="py-name" href="#" onclick="return doclink('link-23', 'DISABLED', 'link-23');">DISABLED</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'DISABLED'</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line"><tt id="link-24" class="py-name" targets="Variable web2py.gluon.scheduler.SECONDS=web2py.gluon.scheduler-module.html#SECONDS"><a title="web2py.gluon.scheduler.SECONDS" class="py-name" href="#" onclick="return doclink('link-24', 'SECONDS', 'link-24');">SECONDS</a></tt> <tt class="py-op">=</tt> <tt class="py-number">1</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"><tt id="link-25" class="py-name" targets="Variable web2py.gluon.scheduler.HEARTBEAT=web2py.gluon.scheduler-module.html#HEARTBEAT"><a title="web2py.gluon.scheduler.HEARTBEAT" class="py-name" href="#" onclick="return doclink('link-25', 'HEARTBEAT', 'link-25');">HEARTBEAT</a></tt> <tt class="py-op">=</tt> <tt class="py-number">3</tt><tt class="py-op">*</tt><tt id="link-26" class="py-name"><a title="web2py.gluon.scheduler.SECONDS" class="py-name" href="#" onclick="return doclink('link-26', 'SECONDS', 'link-24');">SECONDS</a></tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line"> </tt>
<a name="Task"></a><div id="Task-def"><a name="L82"></a><tt class="py-lineno"> 82</tt> <a class="py-toggle" href="#" id="Task-toggle" onclick="return toggle('Task');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="web2py.gluon.scheduler.Task-class.html">Task</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Task-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Task-expanded"><a name="Task.__init__"></a><div id="Task.__init__-def"><a name="L83"></a><tt class="py-lineno"> 83</tt> <a class="py-toggle" href="#" id="Task.__init__-toggle" onclick="return toggle('Task.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.Task-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">app</tt><tt class="py-op">,</tt><tt class="py-param">function</tt><tt class="py-op">,</tt><tt class="py-param">timeout</tt><tt class="py-op">,</tt><tt class="py-param">args</tt><tt class="py-op">=</tt><tt class="py-string">'[]'</tt><tt class="py-op">,</tt><tt class="py-param">vars</tt><tt class="py-op">=</tt><tt class="py-string">'{}'</tt><tt class="py-op">,</tt><tt class="py-op">**</tt><tt class="py-param">kwargs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Task.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Task.__init__-expanded"><a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">        <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name" targets="Module web2py.gluon.debug=web2py.gluon.debug-module.html"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-27', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">' new task allocated: %s.%s'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">app</tt><tt class="py-op">,</tt><tt class="py-name">function</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">app</tt> <tt class="py-op">=</tt> <tt class="py-name">app</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">function</tt> <tt class="py-op">=</tt> <tt class="py-name">function</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">timeout</tt> <tt class="py-op">=</tt> <tt class="py-name">timeout</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">args</tt> <tt class="py-op">=</tt> <tt class="py-name">args</tt> <tt class="py-comment"># json</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">vars</tt> <tt class="py-op">=</tt> <tt class="py-name">vars</tt> <tt class="py-comment"># json</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__dict__</tt><tt class="py-op">.</tt><tt id="link-28" class="py-name" targets="Method web2py.gluon.dal.BaseAdapter.update()=web2py.gluon.dal.BaseAdapter-class.html#update,Method web2py.gluon.dal.CouchDBAdapter.update()=web2py.gluon.dal.CouchDBAdapter-class.html#update,Method web2py.gluon.dal.GoogleDatastoreAdapter.update()=web2py.gluon.dal.GoogleDatastoreAdapter-class.html#update,Method web2py.gluon.dal.IMAPAdapter.update()=web2py.gluon.dal.IMAPAdapter-class.html#update,Method web2py.gluon.dal.MongoDBAdapter.update()=web2py.gluon.dal.MongoDBAdapter-class.html#update,Method web2py.gluon.dal.Set.update()=web2py.gluon.dal.Set-class.html#update,Method web2py.gluon.dal.Table.update()=web2py.gluon.dal.Table-class.html#update,Method web2py.gluon.html.DIV.update()=web2py.gluon.html.DIV-class.html#update,Method web2py.gluon.tools.Crud.update()=web2py.gluon.tools.Crud-class.html#update,Method web2py.gluon.widget.web2pyDialog.update()=web2py.gluon.widget.web2pyDialog-class.html#update"><a title="web2py.gluon.dal.BaseAdapter.update
web2py.gluon.dal.CouchDBAdapter.update
web2py.gluon.dal.GoogleDatastoreAdapter.update
web2py.gluon.dal.IMAPAdapter.update
web2py.gluon.dal.MongoDBAdapter.update
web2py.gluon.dal.Set.update
web2py.gluon.dal.Table.update
web2py.gluon.html.DIV.update
web2py.gluon.tools.Crud.update
web2py.gluon.widget.web2pyDialog.update" class="py-name" href="#" onclick="return doclink('link-28', 'update', 'link-28');">update</a></tt><tt class="py-op">(</tt><tt class="py-name">kwargs</tt><tt class="py-op">)</tt> </tt>
</div><a name="Task.__str__"></a><div id="Task.__str__-def"><a name="L91"></a><tt class="py-lineno"> 91</tt> <a class="py-toggle" href="#" id="Task.__str__-toggle" onclick="return toggle('Task.__str__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.Task-class.html#__str__">__str__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Task.__str__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Task.__str__-expanded"><a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-string">'&lt;Task: %s&gt;'</tt> <tt class="py-op">%</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">function</tt> </tt>
</div></div><a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line"> </tt>
<a name="TaskReport"></a><div id="TaskReport-def"><a name="L94"></a><tt class="py-lineno"> 94</tt> <a class="py-toggle" href="#" id="TaskReport-toggle" onclick="return toggle('TaskReport');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="web2py.gluon.scheduler.TaskReport-class.html">TaskReport</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TaskReport-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="TaskReport-expanded"><a name="TaskReport.__init__"></a><div id="TaskReport.__init__-def"><a name="L95"></a><tt class="py-lineno"> 95</tt> <a class="py-toggle" href="#" id="TaskReport.__init__-toggle" onclick="return toggle('TaskReport.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.TaskReport-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">status</tt><tt class="py-op">,</tt><tt class="py-param">result</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-param">output</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-param">tb</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TaskReport.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TaskReport.__init__-expanded"><a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">        <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-29" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-29', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'    new task report: %s'</tt> <tt class="py-op">%</tt> <tt class="py-name">status</tt><tt class="py-op">)</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">tb</tt><tt class="py-op">:</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-30" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-30', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'   traceback: %s'</tt> <tt class="py-op">%</tt> <tt class="py-name">tb</tt><tt class="py-op">)</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-31" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-31', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'   result: %s'</tt> <tt class="py-op">%</tt> <tt class="py-name">result</tt><tt class="py-op">)</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">status</tt> <tt class="py-op">=</tt> <tt class="py-name">status</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">result</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-32" class="py-name" targets="Method web2py.gluon.template.BlockNode.output()=web2py.gluon.template.BlockNode-class.html#output"><a title="web2py.gluon.template.BlockNode.output" class="py-name" href="#" onclick="return doclink('link-32', 'output', 'link-32');">output</a></tt> <tt class="py-op">=</tt> <tt id="link-33" class="py-name"><a title="web2py.gluon.template.BlockNode.output" class="py-name" href="#" onclick="return doclink('link-33', 'output', 'link-32');">output</a></tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">tb</tt> <tt class="py-op">=</tt> <tt class="py-name">tb</tt> </tt>
</div><a name="TaskReport.__str__"></a><div id="TaskReport.__str__-def"><a name="L105"></a><tt class="py-lineno">105</tt> <a class="py-toggle" href="#" id="TaskReport.__str__-toggle" onclick="return toggle('TaskReport.__str__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.TaskReport-class.html#__str__">__str__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TaskReport.__str__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TaskReport.__str__-expanded"><a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-string">'&lt;TaskReport: %s&gt;'</tt> <tt class="py-op">%</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">status</tt> </tt>
</div></div><a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line"> </tt>
<a name="demo_function"></a><div id="demo_function-def"><a name="L108"></a><tt class="py-lineno">108</tt> <a class="py-toggle" href="#" id="demo_function-toggle" onclick="return toggle('demo_function');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler-module.html#demo_function">demo_function</a><tt class="py-op">(</tt><tt class="py-op">*</tt><tt class="py-param">argv</tt><tt class="py-op">,</tt><tt class="py-op">**</tt><tt class="py-param">kwargs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="demo_function-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="demo_function-expanded"><a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">    <tt class="py-docstring">""" test function """</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">i</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-string">'click'</tt><tt class="py-op">,</tt><tt class="py-name">i</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">        <tt id="link-34" class="py-name"><a title="datetime.time" class="py-name" href="#" onclick="return doclink('link-34', 'time', 'link-1');">time</a></tt><tt class="py-op">.</tt><tt id="link-35" class="py-name" targets="Method web2py.gluon.scheduler.MetaScheduler.sleep()=web2py.gluon.scheduler.MetaScheduler-class.html#sleep,Method web2py.gluon.scheduler.Scheduler.sleep()=web2py.gluon.scheduler.Scheduler-class.html#sleep"><a title="web2py.gluon.scheduler.MetaScheduler.sleep
web2py.gluon.scheduler.Scheduler.sleep" class="py-name" href="#" onclick="return doclink('link-35', 'sleep', 'link-35');">sleep</a></tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-string">'done'</tt> </tt>
</div><a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line"> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line"><tt class="py-comment">#the two functions below deal with simplejson decoding as unicode, esp for the dict decode</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#and subsequent usage as function Keyword arguments unicode variable names won't work!</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#borrowed from http://stackoverflow.com/questions/956867/how-to-get-string-objects-instead-unicode-ones-from-json-in-python</tt> </tt>
<a name="_decode_list"></a><div id="_decode_list-def"><a name="L118"></a><tt class="py-lineno">118</tt> <a class="py-toggle" href="#" id="_decode_list-toggle" onclick="return toggle('_decode_list');">-</a><tt class="py-line"><tt class="py-comment"></tt><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler-module.html#_decode_list">_decode_list</a><tt class="py-op">(</tt><tt class="py-param">lst</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_decode_list-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_decode_list-expanded"><a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">    <tt class="py-name">newlist</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">i</tt> <tt class="py-keyword">in</tt> <tt class="py-name">lst</tt><tt class="py-op">:</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">i</tt><tt class="py-op">,</tt> <tt class="py-name">unicode</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-name">i</tt><tt class="py-op">.</tt><tt id="link-36" class="py-name" targets="Method web2py.gluon.languages.lazyT.encode()=web2py.gluon.languages.lazyT-class.html#encode"><a title="web2py.gluon.languages.lazyT.encode" class="py-name" href="#" onclick="return doclink('link-36', 'encode', 'link-36');">encode</a></tt><tt class="py-op">(</tt><tt class="py-string">'utf-8'</tt><tt class="py-op">)</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">i</tt><tt class="py-op">,</tt> <tt class="py-name">list</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt id="link-37" class="py-name" targets="Function web2py.gluon.scheduler._decode_list()=web2py.gluon.scheduler-module.html#_decode_list"><a title="web2py.gluon.scheduler._decode_list" class="py-name" href="#" onclick="return doclink('link-37', '_decode_list', 'link-37');">_decode_list</a></tt><tt class="py-op">(</tt><tt class="py-name">i</tt><tt class="py-op">)</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">        <tt class="py-name">newlist</tt><tt class="py-op">.</tt><tt id="link-38" class="py-name"><a title="web2py.gluon.html.DIV.append
web2py.gluon.template.BlockNode.append
web2py.gluon.template.Content.append" class="py-name" href="#" onclick="return doclink('link-38', 'append', 'link-5');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">i</tt><tt class="py-op">)</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">newlist</tt> </tt>
</div><a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line"> </tt>
<a name="_decode_dict"></a><div id="_decode_dict-def"><a name="L128"></a><tt class="py-lineno">128</tt> <a class="py-toggle" href="#" id="_decode_dict-toggle" onclick="return toggle('_decode_dict');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler-module.html#_decode_dict">_decode_dict</a><tt class="py-op">(</tt><tt class="py-param">dct</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_decode_dict-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_decode_dict-expanded"><a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">    <tt class="py-name">newdict</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">k</tt><tt class="py-op">,</tt> <tt class="py-name">v</tt> <tt class="py-keyword">in</tt> <tt class="py-name">dct</tt><tt class="py-op">.</tt><tt class="py-name">iteritems</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">k</tt><tt class="py-op">,</tt> <tt class="py-name">unicode</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">            <tt class="py-name">k</tt> <tt class="py-op">=</tt> <tt class="py-name">k</tt><tt class="py-op">.</tt><tt id="link-39" class="py-name"><a title="web2py.gluon.languages.lazyT.encode" class="py-name" href="#" onclick="return doclink('link-39', 'encode', 'link-36');">encode</a></tt><tt class="py-op">(</tt><tt class="py-string">'utf-8'</tt><tt class="py-op">)</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">v</tt><tt class="py-op">,</tt> <tt class="py-name">unicode</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">             <tt class="py-name">v</tt> <tt class="py-op">=</tt> <tt class="py-name">v</tt><tt class="py-op">.</tt><tt id="link-40" class="py-name"><a title="web2py.gluon.languages.lazyT.encode" class="py-name" href="#" onclick="return doclink('link-40', 'encode', 'link-36');">encode</a></tt><tt class="py-op">(</tt><tt class="py-string">'utf-8'</tt><tt class="py-op">)</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">v</tt><tt class="py-op">,</tt> <tt class="py-name">list</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line">            <tt class="py-name">v</tt> <tt class="py-op">=</tt> <tt id="link-41" class="py-name"><a title="web2py.gluon.scheduler._decode_list" class="py-name" href="#" onclick="return doclink('link-41', '_decode_list', 'link-37');">_decode_list</a></tt><tt class="py-op">(</tt><tt class="py-name">v</tt><tt class="py-op">)</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">        <tt class="py-name">newdict</tt><tt class="py-op">[</tt><tt class="py-name">k</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">v</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">newdict</tt> </tt>
</div><a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line"> </tt>
<a name="executor"></a><div id="executor-def"><a name="L140"></a><tt class="py-lineno">140</tt> <a class="py-toggle" href="#" id="executor-toggle" onclick="return toggle('executor');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler-module.html#executor">executor</a><tt class="py-op">(</tt><tt class="py-param">queue</tt><tt class="py-op">,</tt><tt class="py-param">task</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="executor-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="executor-expanded"><a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line">    <tt class="py-docstring">""" the background process """</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line">    <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-42', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'    task started'</tt><tt class="py-op">)</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">    <tt class="py-name">stdout</tt><tt class="py-op">,</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">stdout</tt> <tt class="py-op">=</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">stdout</tt><tt class="py-op">,</tt> <tt class="py-name">cStringIO</tt><tt class="py-op">.</tt><tt class="py-name">StringIO</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">app</tt><tt class="py-op">:</tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line">            <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-43" class="py-name" targets="Method web2py.gluon.winservice.Web2pyService.chdir()=web2py.gluon.winservice.Web2pyService-class.html#chdir"><a title="web2py.gluon.winservice.Web2pyService.chdir" class="py-name" href="#" onclick="return doclink('link-43', 'chdir', 'link-43');">chdir</a></tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">environ</tt><tt class="py-op">[</tt><tt class="py-string">'WEB2PY_PATH'</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line">            <tt class="py-keyword">from</tt> <tt id="link-44" class="py-name"><a title="web2py.gluon" class="py-name" href="#" onclick="return doclink('link-44', 'gluon', 'link-4');">gluon</a></tt><tt class="py-op">.</tt><tt id="link-45" class="py-name" targets="Module web2py.gluon.shell=web2py.gluon.shell-module.html"><a title="web2py.gluon.shell" class="py-name" href="#" onclick="return doclink('link-45', 'shell', 'link-45');">shell</a></tt> <tt class="py-keyword">import</tt> <tt id="link-46" class="py-name" targets="Function web2py.gluon.shell.env()=web2py.gluon.shell-module.html#env"><a title="web2py.gluon.shell.env" class="py-name" href="#" onclick="return doclink('link-46', 'env', 'link-46');">env</a></tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line">            <tt class="py-keyword">from</tt> <tt id="link-47" class="py-name"><a title="web2py.gluon" class="py-name" href="#" onclick="return doclink('link-47', 'gluon', 'link-4');">gluon</a></tt><tt class="py-op">.</tt><tt id="link-48" class="py-name" targets="Module web2py.gluon.dal=web2py.gluon.dal-module.html"><a title="web2py.gluon.dal" class="py-name" href="#" onclick="return doclink('link-48', 'dal', 'link-48');">dal</a></tt> <tt class="py-keyword">import</tt> <tt id="link-49" class="py-name" targets="Class web2py.gluon.dal.BaseAdapter=web2py.gluon.dal.BaseAdapter-class.html"><a title="web2py.gluon.dal.BaseAdapter" class="py-name" href="#" onclick="return doclink('link-49', 'BaseAdapter', 'link-49');">BaseAdapter</a></tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line">            <tt class="py-keyword">from</tt> <tt id="link-50" class="py-name"><a title="web2py.gluon" class="py-name" href="#" onclick="return doclink('link-50', 'gluon', 'link-4');">gluon</a></tt> <tt class="py-keyword">import</tt> <tt id="link-51" class="py-name" targets="Variable web2py.gluon.current=web2py.gluon-module.html#current,Variable web2py.gluon.globals.current=web2py.gluon.globals-module.html#current,Variable web2py.gluon.tools.current=web2py.gluon.tools-module.html#current"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-51', 'current', 'link-51');">current</a></tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line">            <tt class="py-name">level</tt> <tt class="py-op">=</tt> <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt class="py-name">getLogger</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">getEffectiveLevel</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line">            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt class="py-name">getLogger</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">setLevel</tt><tt class="py-op">(</tt><tt class="py-name">logging</tt><tt class="py-op">.</tt><tt class="py-name">WARN</tt><tt class="py-op">)</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line">            <tt class="py-name">_env</tt> <tt class="py-op">=</tt> <tt id="link-52" class="py-name"><a title="web2py.gluon.shell.env" class="py-name" href="#" onclick="return doclink('link-52', 'env', 'link-46');">env</a></tt><tt class="py-op">(</tt><tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">app</tt><tt class="py-op">,</tt><tt class="py-name">import_models</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt class="py-name">getLogger</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">setLevel</tt><tt class="py-op">(</tt><tt class="py-name">level</tt><tt class="py-op">)</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">            <tt id="link-53" class="py-name" targets="Module web2py.gluon.scheduler=web2py.gluon.scheduler-module.html"><a title="web2py.gluon.scheduler" class="py-name" href="#" onclick="return doclink('link-53', 'scheduler', 'link-53');">scheduler</a></tt> <tt class="py-op">=</tt> <tt id="link-54" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-54', 'current', 'link-51');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">_scheduler</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">            <tt class="py-name">scheduler_tasks</tt> <tt class="py-op">=</tt> <tt id="link-55" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-55', 'current', 'link-51');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">_scheduler</tt><tt class="py-op">.</tt><tt class="py-name">tasks</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line">            <tt class="py-name">_function</tt> <tt class="py-op">=</tt> <tt class="py-name">scheduler_tasks</tt><tt class="py-op">[</tt><tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">function</tt><tt class="py-op">]</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">            <tt id="link-56" class="py-name" targets="Module web2py.gluon.globals=web2py.gluon.globals-module.html"><a title="web2py.gluon.globals" class="py-name" href="#" onclick="return doclink('link-56', 'globals', 'link-56');">globals</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-57" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.update
web2py.gluon.dal.CouchDBAdapter.update
web2py.gluon.dal.GoogleDatastoreAdapter.update
web2py.gluon.dal.IMAPAdapter.update
web2py.gluon.dal.MongoDBAdapter.update
web2py.gluon.dal.Set.update
web2py.gluon.dal.Table.update
web2py.gluon.html.DIV.update
web2py.gluon.tools.Crud.update
web2py.gluon.widget.web2pyDialog.update" class="py-name" href="#" onclick="return doclink('link-57', 'update', 'link-28');">update</a></tt><tt class="py-op">(</tt><tt class="py-name">_env</tt><tt class="py-op">)</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line">            <tt class="py-name">args</tt> <tt class="py-op">=</tt> <tt class="py-name">loads</tt><tt class="py-op">(</tt><tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">args</tt><tt class="py-op">)</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">            <tt class="py-name">vars</tt> <tt class="py-op">=</tt> <tt class="py-name">loads</tt><tt class="py-op">(</tt><tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">vars</tt><tt class="py-op">,</tt> <tt class="py-name">object_hook</tt><tt class="py-op">=</tt><tt id="link-58" class="py-name" targets="Function web2py.gluon.scheduler._decode_dict()=web2py.gluon.scheduler-module.html#_decode_dict"><a title="web2py.gluon.scheduler._decode_dict" class="py-name" href="#" onclick="return doclink('link-58', '_decode_dict', 'link-58');">_decode_dict</a></tt><tt class="py-op">)</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line">            <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">dumps</tt><tt class="py-op">(</tt><tt class="py-name">_function</tt><tt class="py-op">(</tt><tt class="py-op">*</tt><tt class="py-name">args</tt><tt class="py-op">,</tt><tt class="py-op">**</tt><tt class="py-name">vars</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line">            <tt class="py-comment">### for testing purpose only</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">eval</tt><tt class="py-op">(</tt><tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">function</tt><tt class="py-op">)</tt><tt class="py-op">(</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line">                <tt class="py-op">*</tt><tt class="py-name">loads</tt><tt class="py-op">(</tt><tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">args</tt><tt class="py-op">,</tt> <tt class="py-name">object_hook</tt><tt class="py-op">=</tt><tt id="link-59" class="py-name"><a title="web2py.gluon.scheduler._decode_dict" class="py-name" href="#" onclick="return doclink('link-59', '_decode_dict', 'link-58');">_decode_dict</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line">                 <tt class="py-op">**</tt><tt class="py-name">loads</tt><tt class="py-op">(</tt><tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">vars</tt><tt class="py-op">,</tt> <tt class="py-name">object_hook</tt><tt class="py-op">=</tt><tt id="link-60" class="py-name"><a title="web2py.gluon.scheduler._decode_dict" class="py-name" href="#" onclick="return doclink('link-60', '_decode_dict', 'link-58');">_decode_dict</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line">        <tt class="py-name">stdout</tt><tt class="py-op">,</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">stdout</tt> <tt class="py-op">=</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">stdout</tt><tt class="py-op">,</tt> <tt class="py-name">stdout</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line">        <tt class="py-name">queue</tt><tt class="py-op">.</tt><tt class="py-name">put</tt><tt class="py-op">(</tt><tt id="link-61" class="py-name" targets="Class web2py.gluon.scheduler.TaskReport=web2py.gluon.scheduler.TaskReport-class.html"><a title="web2py.gluon.scheduler.TaskReport" class="py-name" href="#" onclick="return doclink('link-61', 'TaskReport', 'link-61');">TaskReport</a></tt><tt class="py-op">(</tt><tt id="link-62" class="py-name"><a title="web2py.gluon.scheduler.COMPLETED" class="py-name" href="#" onclick="return doclink('link-62', 'COMPLETED', 'link-17');">COMPLETED</a></tt><tt class="py-op">,</tt> <tt class="py-name">result</tt><tt class="py-op">,</tt><tt class="py-name">stdout</tt><tt class="py-op">.</tt><tt class="py-name">getvalue</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt> <tt class="py-name">BaseException</tt><tt class="py-op">,</tt><tt class="py-name">e</tt><tt class="py-op">:</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line">        <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">stdout</tt> <tt class="py-op">=</tt> <tt class="py-name">stdout</tt> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line">        <tt class="py-name">tb</tt> <tt class="py-op">=</tt> <tt class="py-name">traceback</tt><tt class="py-op">.</tt><tt class="py-name">format_exc</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line">        <tt class="py-name">queue</tt><tt class="py-op">.</tt><tt class="py-name">put</tt><tt class="py-op">(</tt><tt id="link-63" class="py-name"><a title="web2py.gluon.scheduler.TaskReport" class="py-name" href="#" onclick="return doclink('link-63', 'TaskReport', 'link-61');">TaskReport</a></tt><tt class="py-op">(</tt><tt id="link-64" class="py-name"><a title="web2py.gluon.scheduler.FAILED" class="py-name" href="#" onclick="return doclink('link-64', 'FAILED', 'link-18');">FAILED</a></tt><tt class="py-op">,</tt><tt class="py-name">tb</tt><tt class="py-op">=</tt><tt class="py-name">tb</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line"> </tt>
<a name="MetaScheduler"></a><div id="MetaScheduler-def"><a name="L173"></a><tt class="py-lineno">173</tt> <a class="py-toggle" href="#" id="MetaScheduler-toggle" onclick="return toggle('MetaScheduler');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="web2py.gluon.scheduler.MetaScheduler-class.html">MetaScheduler</a><tt class="py-op">(</tt><tt class="py-base-class">threading</tt><tt class="py-op">.</tt><tt class="py-base-class">Thread</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="MetaScheduler-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="MetaScheduler-expanded"><a name="MetaScheduler.__init__"></a><div id="MetaScheduler.__init__-def"><a name="L174"></a><tt class="py-lineno">174</tt> <a class="py-toggle" href="#" id="MetaScheduler.__init__-toggle" onclick="return toggle('MetaScheduler.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.MetaScheduler-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="MetaScheduler.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MetaScheduler.__init__-expanded"><a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line">        <tt class="py-name">threading</tt><tt class="py-op">.</tt><tt class="py-name">Thread</tt><tt class="py-op">.</tt><tt id="link-65" class="py-name" targets="Method web2py.gluon.cache.Cache.__init__()=web2py.gluon.cache.Cache-class.html#__init__,Method web2py.gluon.cache.CacheAbstract.__init__()=web2py.gluon.cache.CacheAbstract-class.html#__init__,Method web2py.gluon.cache.CacheInRam.__init__()=web2py.gluon.cache.CacheInRam-class.html#__init__,Method web2py.gluon.cache.CacheOnDisk.__init__()=web2py.gluon.cache.CacheOnDisk-class.html#__init__,Method web2py.gluon.compileapp.LoadFactory.__init__()=web2py.gluon.compileapp.LoadFactory-class.html#__init__,Method web2py.gluon.custom_import._DateTrackerImporter.__init__()=web2py.gluon.custom_import._DateTrackerImporter-class.html#__init__,Method web2py.gluon.custom_import._Web2pyImporter.__init__()=web2py.gluon.custom_import._Web2pyImporter-class.html#__init__,Method web2py.gluon.dal.BaseAdapter.__init__()=web2py.gluon.dal.BaseAdapter-class.html#__init__,Method web2py.gluon.dal.CouchDBAdapter.__init__()=web2py.gluon.dal.CouchDBAdapter-class.html#__init__,Method web2py.gluon.dal.CubridAdapter.__init__()=web2py.gluon.dal.CubridAdapter-class.html#__init__,Method web2py.gluon.dal.DAL.__init__()=web2py.gluon.dal.DAL-class.html#__init__,Method web2py.gluon.dal.DB2Adapter.__init__()=web2py.gluon.dal.DB2Adapter-class.html#__init__,Method web2py.gluon.dal.DatabaseStoredFile.__init__()=web2py.gluon.dal.DatabaseStoredFile-class.html#__init__,Method web2py.gluon.dal.Expression.__init__()=web2py.gluon.dal.Expression-class.html#__init__,Method web2py.gluon.dal.Field.__init__()=web2py.gluon.dal.Field-class.html#__init__,Method web2py.gluon.dal.FieldLazy.__init__()=web2py.gluon.dal.FieldLazy-class.html#__init__,Method web2py.gluon.dal.FieldVirtual.__init__()=web2py.gluon.dal.FieldVirtual-class.html#__init__,Method web2py.gluon.dal.FireBirdAdapter.__init__()=web2py.gluon.dal.FireBirdAdapter-class.html#__init__,Method web2py.gluon.dal.FireBirdEmbeddedAdapter.__init__()=web2py.gluon.dal.FireBirdEmbeddedAdapter-class.html#__init__,Method web2py.gluon.dal.GAEDecimalProperty.__init__()=web2py.gluon.dal.GAEDecimalProperty-class.html#__init__,Method web2py.gluon.dal.GAEF.__init__()=web2py.gluon.dal.GAEF-class.html#__init__,Method web2py.gluon.dal.GoogleDatastoreAdapter.__init__()=web2py.gluon.dal.GoogleDatastoreAdapter-class.html#__init__,Method web2py.gluon.dal.GoogleSQLAdapter.__init__()=web2py.gluon.dal.GoogleSQLAdapter-class.html#__init__,Method web2py.gluon.dal.IMAPAdapter.__init__()=web2py.gluon.dal.IMAPAdapter-class.html#__init__,Method web2py.gluon.dal.InformixAdapter.__init__()=web2py.gluon.dal.InformixAdapter-class.html#__init__,Method web2py.gluon.dal.IngresAdapter.__init__()=web2py.gluon.dal.IngresAdapter-class.html#__init__,Method web2py.gluon.dal.JDBCPostgreSQLAdapter.__init__()=web2py.gluon.dal.JDBCPostgreSQLAdapter-class.html#__init__,Method web2py.gluon.dal.JDBCSQLiteAdapter.__init__()=web2py.gluon.dal.JDBCSQLiteAdapter-class.html#__init__,Method web2py.gluon.dal.MSSQLAdapter.__init__()=web2py.gluon.dal.MSSQLAdapter-class.html#__init__,Method web2py.gluon.dal.MongoDBAdapter.__init__()=web2py.gluon.dal.MongoDBAdapter-class.html#__init__,Method web2py.gluon.dal.MySQLAdapter.__init__()=web2py.gluon.dal.MySQLAdapter-class.html#__init__,Method web2py.gluon.dal.OracleAdapter.__init__()=web2py.gluon.dal.OracleAdapter-class.html#__init__,Method web2py.gluon.dal.PostgreSQLAdapter.__init__()=web2py.gluon.dal.PostgreSQLAdapter-class.html#__init__,Method web2py.gluon.dal.Query.__init__()=web2py.gluon.dal.Query-class.html#__init__,Method web2py.gluon.dal.Rows.__init__()=web2py.gluon.dal.Rows-class.html#__init__,Method web2py.gluon.dal.SAPDBAdapter.__init__()=web2py.gluon.dal.SAPDBAdapter-class.html#__init__,Method web2py.gluon.dal.SQLALL.__init__()=web2py.gluon.dal.SQLALL-class.html#__init__,Method web2py.gluon.dal.SQLCustomType.__init__()=web2py.gluon.dal.SQLCustomType-class.html#__init__,Method web2py.gluon.dal.SQLiteAdapter.__init__()=web2py.gluon.dal.SQLiteAdapter-class.html#__init__,Method web2py.gluon.dal.Set.__init__()=web2py.gluon.dal.Set-class.html#__init__,Method web2py.gluon.dal.Table.__init__()=web2py.gluon.dal.Table-class.html#__init__,Method web2py.gluon.dal.TeradataAdapter.__init__()=web2py.gluon.dal.TeradataAdapter-class.html#__init__,Method web2py.gluon.dal.VirtualCommand.__init__()=web2py.gluon.dal.VirtualCommand-class.html#__init__,Method web2py.gluon.debug.Pipe.__init__()=web2py.gluon.debug.Pipe-class.html#__init__,Method web2py.gluon.debug.WebDebugger.__init__()=web2py.gluon.debug.WebDebugger-class.html#__init__,Method web2py.gluon.globals.Request.__init__()=web2py.gluon.globals.Request-class.html#__init__,Method web2py.gluon.globals.Response.__init__()=web2py.gluon.globals.Response-class.html#__init__,Method web2py.gluon.highlight.Highlighter.__init__()=web2py.gluon.highlight.Highlighter-class.html#__init__,Method web2py.gluon.html.BEAUTIFY.__init__()=web2py.gluon.html.BEAUTIFY-class.html#__init__,Method web2py.gluon.html.DIV.__init__()=web2py.gluon.html.DIV-class.html#__init__,Method web2py.gluon.html.FORM.__init__()=web2py.gluon.html.FORM-class.html#__init__,Method web2py.gluon.html.MARKMIN.__init__()=web2py.gluon.html.MARKMIN-class.html#__init__,Method web2py.gluon.html.MENU.__init__()=web2py.gluon.html.MENU-class.html#__init__,Method web2py.gluon.html.XML.__init__()=web2py.gluon.html.XML-class.html#__init__,Method web2py.gluon.html.web2pyHTMLParser.__init__()=web2py.gluon.html.web2pyHTMLParser-class.html#__init__,Method web2py.gluon.http.HTTP.__init__()=web2py.gluon.http.HTTP-class.html#__init__,Method web2py.gluon.languages.lazyT.__init__()=web2py.gluon.languages.lazyT-class.html#__init__,Method web2py.gluon.languages.translator.__init__()=web2py.gluon.languages.translator-class.html#__init__,Method web2py.gluon.main.HttpServer.__init__()=web2py.gluon.main.HttpServer-class.html#__init__,Method web2py.gluon.newcron.Token.__init__()=web2py.gluon.newcron.Token-class.html#__init__,Method web2py.gluon.newcron.cronlauncher.__init__()=web2py.gluon.newcron.cronlauncher-class.html#__init__,Method web2py.gluon.newcron.extcron.__init__()=web2py.gluon.newcron.extcron-class.html#__init__,Method web2py.gluon.newcron.hardcron.__init__()=web2py.gluon.newcron.hardcron-class.html#__init__,Method web2py.gluon.newcron.softcron.__init__()=web2py.gluon.newcron.softcron-class.html#__init__,Method web2py.gluon.portalocker.LockedFile.__init__()=web2py.gluon.portalocker.LockedFile-class.html#__init__,Method web2py.gluon.restricted.RestrictedError.__init__()=web2py.gluon.restricted.RestrictedError-class.html#__init__,Method web2py.gluon.restricted.TicketStorage.__init__()=web2py.gluon.restricted.TicketStorage-class.html#__init__,Method web2py.gluon.rewrite.MapUrlIn.__init__()=web2py.gluon.rewrite.MapUrlIn-class.html#__init__,Method web2py.gluon.rewrite.MapUrlOut.__init__()=web2py.gluon.rewrite.MapUrlOut-class.html#__init__,Method web2py.gluon.rocket.ChunkedReader.__init__()=web2py.gluon.rocket.ChunkedReader-class.html#__init__,Method web2py.gluon.rocket.Connection.__init__()=web2py.gluon.rocket.Connection-class.html#__init__,Method web2py.gluon.rocket.FileLikeSocket.__init__()=web2py.gluon.rocket.FileLikeSocket-class.html#__init__,Method web2py.gluon.rocket.FileSystemWorker.__init__()=web2py.gluon.rocket.FileSystemWorker-class.html#__init__,Method web2py.gluon.rocket.FuturesMiddleware.__init__()=web2py.gluon.rocket.FuturesMiddleware-class.html#__init__,Method web2py.gluon.rocket.LimitingFileWrapper.__init__()=web2py.gluon.rocket.LimitingFileWrapper-class.html#__init__,Method web2py.gluon.rocket.Listener.__init__()=web2py.gluon.rocket.Listener-class.html#__init__,Method web2py.gluon.rocket.Monitor.__init__()=web2py.gluon.rocket.Monitor-class.html#__init__,Method web2py.gluon.rocket.Rocket.__init__()=web2py.gluon.rocket.Rocket-class.html#__init__,Method web2py.gluon.rocket.ThreadPool.__init__()=web2py.gluon.rocket.ThreadPool-class.html#__init__,Method web2py.gluon.rocket.WSGIExecutor.__init__()=web2py.gluon.rocket.WSGIExecutor-class.html#__init__,Method web2py.gluon.rocket.WSGIFuture.__init__()=web2py.gluon.rocket.WSGIFuture-class.html#__init__,Method web2py.gluon.rocket.WSGIWorker.__init__()=web2py.gluon.rocket.WSGIWorker-class.html#__init__,Method web2py.gluon.rocket.Worker.__init__()=web2py.gluon.rocket.Worker-class.html#__init__,Method web2py.gluon.rocket._WorkItem.__init__()=web2py.gluon.rocket._WorkItem-class.html#__init__,Method web2py.gluon.sanitizer.XssCleaner.__init__()=web2py.gluon.sanitizer.XssCleaner-class.html#__init__,Method web2py.gluon.scheduler.MetaScheduler.__init__()=web2py.gluon.scheduler.MetaScheduler-class.html#__init__,Method web2py.gluon.scheduler.Scheduler.__init__()=web2py.gluon.scheduler.Scheduler-class.html#__init__,Method web2py.gluon.scheduler.TYPE.__init__()=web2py.gluon.scheduler.TYPE-class.html#__init__,Method web2py.gluon.scheduler.Task.__init__()=web2py.gluon.scheduler.Task-class.html#__init__,Method web2py.gluon.scheduler.TaskReport.__init__()=web2py.gluon.scheduler.TaskReport-class.html#__init__,Method web2py.gluon.sqlhtml.AutocompleteWidget.__init__()=web2py.gluon.sqlhtml.AutocompleteWidget-class.html#__init__,Method web2py.gluon.sqlhtml.SQLFORM.__init__()=web2py.gluon.sqlhtml.SQLFORM-class.html#__init__,Method web2py.gluon.sqlhtml.SQLTABLE.__init__()=web2py.gluon.sqlhtml.SQLTABLE-class.html#__init__,Method web2py.gluon.storage.Messages.__init__()=web2py.gluon.storage.Messages-class.html#__init__,Method web2py.gluon.template.BlockNode.__init__()=web2py.gluon.template.BlockNode-class.html#__init__,Method web2py.gluon.template.Content.__init__()=web2py.gluon.template.Content-class.html#__init__,Method web2py.gluon.template.Node.__init__()=web2py.gluon.template.Node-class.html#__init__,Method web2py.gluon.template.SuperNode.__init__()=web2py.gluon.template.SuperNode-class.html#__init__,Method web2py.gluon.template.TemplateParser.__init__()=web2py.gluon.template.TemplateParser-class.html#__init__,Method web2py.gluon.tools.Auth.__init__()=web2py.gluon.tools.Auth-class.html#__init__,Method web2py.gluon.tools.Crud.__init__()=web2py.gluon.tools.Crud-class.html#__init__,Method web2py.gluon.tools.Expose.__init__()=web2py.gluon.tools.Expose-class.html#__init__,Method web2py.gluon.tools.Mail.Attachment.__init__()=web2py.gluon.tools.Mail.Attachment-class.html#__init__,Method web2py.gluon.tools.Mail.__init__()=web2py.gluon.tools.Mail-class.html#__init__,Method web2py.gluon.tools.PluginManager.__init__()=web2py.gluon.tools.PluginManager-class.html#__init__,Method web2py.gluon.tools.Recaptcha.__init__()=web2py.gluon.tools.Recaptcha-class.html#__init__,Method web2py.gluon.tools.Service.JsonRpcException.__init__()=web2py.gluon.tools.Service.JsonRpcException-class.html#__init__,Method web2py.gluon.tools.Service.__init__()=web2py.gluon.tools.Service-class.html#__init__,Method web2py.gluon.validators.CLEANUP.__init__()=web2py.gluon.validators.CLEANUP-class.html#__init__,Method web2py.gluon.validators.CRYPT.__init__()=web2py.gluon.validators.CRYPT-class.html#__init__,Method web2py.gluon.validators.IS_ALPHANUMERIC.__init__()=web2py.gluon.validators.IS_ALPHANUMERIC-class.html#__init__,Method web2py.gluon.validators.IS_DATE.__init__()=web2py.gluon.validators.IS_DATE-class.html#__init__,Method web2py.gluon.validators.IS_DATETIME.__init__()=web2py.gluon.validators.IS_DATETIME-class.html#__init__,Method web2py.gluon.validators.IS_DATETIME_IN_RANGE.__init__()=web2py.gluon.validators.IS_DATETIME_IN_RANGE-class.html#__init__,Method web2py.gluon.validators.IS_DATE_IN_RANGE.__init__()=web2py.gluon.validators.IS_DATE_IN_RANGE-class.html#__init__,Method web2py.gluon.validators.IS_DECIMAL_IN_RANGE.__init__()=web2py.gluon.validators.IS_DECIMAL_IN_RANGE-class.html#__init__,Method web2py.gluon.validators.IS_EMAIL.__init__()=web2py.gluon.validators.IS_EMAIL-class.html#__init__,Method web2py.gluon.validators.IS_EMPTY_OR.__init__()=web2py.gluon.validators.IS_EMPTY_OR-class.html#__init__,Method web2py.gluon.validators.IS_EQUAL_TO.__init__()=web2py.gluon.validators.IS_EQUAL_TO-class.html#__init__,Method web2py.gluon.validators.IS_EXPR.__init__()=web2py.gluon.validators.IS_EXPR-class.html#__init__,Method web2py.gluon.validators.IS_FLOAT_IN_RANGE.__init__()=web2py.gluon.validators.IS_FLOAT_IN_RANGE-class.html#__init__,Method web2py.gluon.validators.IS_GENERIC_URL.__init__()=web2py.gluon.validators.IS_GENERIC_URL-class.html#__init__,Method web2py.gluon.validators.IS_HTTP_URL.__init__()=web2py.gluon.validators.IS_HTTP_URL-class.html#__init__,Method web2py.gluon.validators.IS_IMAGE.__init__()=web2py.gluon.validators.IS_IMAGE-class.html#__init__,Method web2py.gluon.validators.IS_INT_IN_RANGE.__init__()=web2py.gluon.validators.IS_INT_IN_RANGE-class.html#__init__,Method web2py.gluon.validators.IS_IN_DB.__init__()=web2py.gluon.validators.IS_IN_DB-class.html#__init__,Method web2py.gluon.validators.IS_IN_SET.__init__()=web2py.gluon.validators.IS_IN_SET-class.html#__init__,Method web2py.gluon.validators.IS_IN_SUBSET.__init__()=web2py.gluon.validators.IS_IN_SUBSET-class.html#__init__,Method web2py.gluon.validators.IS_IPV4.__init__()=web2py.gluon.validators.IS_IPV4-class.html#__init__,Method web2py.gluon.validators.IS_LENGTH.__init__()=web2py.gluon.validators.IS_LENGTH-class.html#__init__,Method web2py.gluon.validators.IS_LIST_OF.__init__()=web2py.gluon.validators.IS_LIST_OF-class.html#__init__,Method web2py.gluon.validators.IS_MATCH.__init__()=web2py.gluon.validators.IS_MATCH-class.html#__init__,Method web2py.gluon.validators.IS_NOT_EMPTY.__init__()=web2py.gluon.validators.IS_NOT_EMPTY-class.html#__init__,Method web2py.gluon.validators.IS_NOT_IN_DB.__init__()=web2py.gluon.validators.IS_NOT_IN_DB-class.html#__init__,Method web2py.gluon.validators.IS_SLUG.__init__()=web2py.gluon.validators.IS_SLUG-class.html#__init__,Method web2py.gluon.validators.IS_STRONG.__init__()=web2py.gluon.validators.IS_STRONG-class.html#__init__,Method web2py.gluon.validators.IS_TIME.__init__()=web2py.gluon.validators.IS_TIME-class.html#__init__,Method web2py.gluon.validators.IS_UPLOAD_FILENAME.__init__()=web2py.gluon.validators.IS_UPLOAD_FILENAME-class.html#__init__,Method web2py.gluon.validators.IS_URL.__init__()=web2py.gluon.validators.IS_URL-class.html#__init__,Method web2py.gluon.widget.IO.__init__()=web2py.gluon.widget.IO-class.html#__init__,Method web2py.gluon.widget.web2pyDialog.__init__()=web2py.gluon.widget.web2pyDialog-class.html#__init__,Method web2py.gluon.winservice.Service.__init__()=web2py.gluon.winservice.Service-class.html#__init__"><a title="web2py.gluon.cache.Cache.__init__
web2py.gluon.cache.CacheAbstract.__init__
web2py.gluon.cache.CacheInRam.__init__
web2py.gluon.cache.CacheOnDisk.__init__
web2py.gluon.compileapp.LoadFactory.__init__
web2py.gluon.custom_import._DateTrackerImporter.__init__
web2py.gluon.custom_import._Web2pyImporter.__init__
web2py.gluon.dal.BaseAdapter.__init__
web2py.gluon.dal.CouchDBAdapter.__init__
web2py.gluon.dal.CubridAdapter.__init__
web2py.gluon.dal.DAL.__init__
web2py.gluon.dal.DB2Adapter.__init__
web2py.gluon.dal.DatabaseStoredFile.__init__
web2py.gluon.dal.Expression.__init__
web2py.gluon.dal.Field.__init__
web2py.gluon.dal.FieldLazy.__init__
web2py.gluon.dal.FieldVirtual.__init__
web2py.gluon.dal.FireBirdAdapter.__init__
web2py.gluon.dal.FireBirdEmbeddedAdapter.__init__
web2py.gluon.dal.GAEDecimalProperty.__init__
web2py.gluon.dal.GAEF.__init__
web2py.gluon.dal.GoogleDatastoreAdapter.__init__
web2py.gluon.dal.GoogleSQLAdapter.__init__
web2py.gluon.dal.IMAPAdapter.__init__
web2py.gluon.dal.InformixAdapter.__init__
web2py.gluon.dal.IngresAdapter.__init__
web2py.gluon.dal.JDBCPostgreSQLAdapter.__init__
web2py.gluon.dal.JDBCSQLiteAdapter.__init__
web2py.gluon.dal.MSSQLAdapter.__init__
web2py.gluon.dal.MongoDBAdapter.__init__
web2py.gluon.dal.MySQLAdapter.__init__
web2py.gluon.dal.OracleAdapter.__init__
web2py.gluon.dal.PostgreSQLAdapter.__init__
web2py.gluon.dal.Query.__init__
web2py.gluon.dal.Rows.__init__
web2py.gluon.dal.SAPDBAdapter.__init__
web2py.gluon.dal.SQLALL.__init__
web2py.gluon.dal.SQLCustomType.__init__
web2py.gluon.dal.SQLiteAdapter.__init__
web2py.gluon.dal.Set.__init__
web2py.gluon.dal.Table.__init__
web2py.gluon.dal.TeradataAdapter.__init__
web2py.gluon.dal.VirtualCommand.__init__
web2py.gluon.debug.Pipe.__init__
web2py.gluon.debug.WebDebugger.__init__
web2py.gluon.globals.Request.__init__
web2py.gluon.globals.Response.__init__
web2py.gluon.highlight.Highlighter.__init__
web2py.gluon.html.BEAUTIFY.__init__
web2py.gluon.html.DIV.__init__
web2py.gluon.html.FORM.__init__
web2py.gluon.html.MARKMIN.__init__
web2py.gluon.html.MENU.__init__
web2py.gluon.html.XML.__init__
web2py.gluon.html.web2pyHTMLParser.__init__
web2py.gluon.http.HTTP.__init__
web2py.gluon.languages.lazyT.__init__
web2py.gluon.languages.translator.__init__
web2py.gluon.main.HttpServer.__init__
web2py.gluon.newcron.Token.__init__
web2py.gluon.newcron.cronlauncher.__init__
web2py.gluon.newcron.extcron.__init__
web2py.gluon.newcron.hardcron.__init__
web2py.gluon.newcron.softcron.__init__
web2py.gluon.portalocker.LockedFile.__init__
web2py.gluon.restricted.RestrictedError.__init__
web2py.gluon.restricted.TicketStorage.__init__
web2py.gluon.rewrite.MapUrlIn.__init__
web2py.gluon.rewrite.MapUrlOut.__init__
web2py.gluon.rocket.ChunkedReader.__init__
web2py.gluon.rocket.Connection.__init__
web2py.gluon.rocket.FileLikeSocket.__init__
web2py.gluon.rocket.FileSystemWorker.__init__
web2py.gluon.rocket.FuturesMiddleware.__init__
web2py.gluon.rocket.LimitingFileWrapper.__init__
web2py.gluon.rocket.Listener.__init__
web2py.gluon.rocket.Monitor.__init__
web2py.gluon.rocket.Rocket.__init__
web2py.gluon.rocket.ThreadPool.__init__
web2py.gluon.rocket.WSGIExecutor.__init__
web2py.gluon.rocket.WSGIFuture.__init__
web2py.gluon.rocket.WSGIWorker.__init__
web2py.gluon.rocket.Worker.__init__
web2py.gluon.rocket._WorkItem.__init__
web2py.gluon.sanitizer.XssCleaner.__init__
web2py.gluon.scheduler.MetaScheduler.__init__
web2py.gluon.scheduler.Scheduler.__init__
web2py.gluon.scheduler.TYPE.__init__
web2py.gluon.scheduler.Task.__init__
web2py.gluon.scheduler.TaskReport.__init__
web2py.gluon.sqlhtml.AutocompleteWidget.__init__
web2py.gluon.sqlhtml.SQLFORM.__init__
web2py.gluon.sqlhtml.SQLTABLE.__init__
web2py.gluon.storage.Messages.__init__
web2py.gluon.template.BlockNode.__init__
web2py.gluon.template.Content.__init__
web2py.gluon.template.Node.__init__
web2py.gluon.template.SuperNode.__init__
web2py.gluon.template.TemplateParser.__init__
web2py.gluon.tools.Auth.__init__
web2py.gluon.tools.Crud.__init__
web2py.gluon.tools.Expose.__init__
web2py.gluon.tools.Mail.Attachment.__init__
web2py.gluon.tools.Mail.__init__
web2py.gluon.tools.PluginManager.__init__
web2py.gluon.tools.Recaptcha.__init__
web2py.gluon.tools.Service.JsonRpcException.__init__
web2py.gluon.tools.Service.__init__
web2py.gluon.validators.CLEANUP.__init__
web2py.gluon.validators.CRYPT.__init__
web2py.gluon.validators.IS_ALPHANUMERIC.__init__
web2py.gluon.validators.IS_DATE.__init__
web2py.gluon.validators.IS_DATETIME.__init__
web2py.gluon.validators.IS_DATETIME_IN_RANGE.__init__
web2py.gluon.validators.IS_DATE_IN_RANGE.__init__
web2py.gluon.validators.IS_DECIMAL_IN_RANGE.__init__
web2py.gluon.validators.IS_EMAIL.__init__
web2py.gluon.validators.IS_EMPTY_OR.__init__
web2py.gluon.validators.IS_EQUAL_TO.__init__
web2py.gluon.validators.IS_EXPR.__init__
web2py.gluon.validators.IS_FLOAT_IN_RANGE.__init__
web2py.gluon.validators.IS_GENERIC_URL.__init__
web2py.gluon.validators.IS_HTTP_URL.__init__
web2py.gluon.validators.IS_IMAGE.__init__
web2py.gluon.validators.IS_INT_IN_RANGE.__init__
web2py.gluon.validators.IS_IN_DB.__init__
web2py.gluon.validators.IS_IN_SET.__init__
web2py.gluon.validators.IS_IN_SUBSET.__init__
web2py.gluon.validators.IS_IPV4.__init__
web2py.gluon.validators.IS_LENGTH.__init__
web2py.gluon.validators.IS_LIST_OF.__init__
web2py.gluon.validators.IS_MATCH.__init__
web2py.gluon.validators.IS_NOT_EMPTY.__init__
web2py.gluon.validators.IS_NOT_IN_DB.__init__
web2py.gluon.validators.IS_SLUG.__init__
web2py.gluon.validators.IS_STRONG.__init__
web2py.gluon.validators.IS_TIME.__init__
web2py.gluon.validators.IS_UPLOAD_FILENAME.__init__
web2py.gluon.validators.IS_URL.__init__
web2py.gluon.widget.IO.__init__
web2py.gluon.widget.web2pyDialog.__init__
web2py.gluon.winservice.Service.__init__" class="py-name" href="#" onclick="return doclink('link-65', '__init__', 'link-65');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-66" class="py-name" targets="Method web2py.gluon.html.FORM.process()=web2py.gluon.html.FORM-class.html#process"><a title="web2py.gluon.html.FORM.process" class="py-name" href="#" onclick="return doclink('link-66', 'process', 'link-66');">process</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt>     <tt class="py-comment"># the backround process</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">have_heartbeat</tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt>   <tt class="py-comment"># set to False to kill</tt> </tt>
</div><a name="MetaScheduler.async"></a><div id="MetaScheduler.async-def"><a name="L178"></a><tt class="py-lineno">178</tt> <a class="py-toggle" href="#" id="MetaScheduler.async-toggle" onclick="return toggle('MetaScheduler.async');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.MetaScheduler-class.html#async">async</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">task</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="MetaScheduler.async-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MetaScheduler.async-expanded"><a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line"><tt class="py-docstring">        starts the background process and returns:</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line"><tt class="py-docstring">        ('ok',result,output)</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line"><tt class="py-docstring">        ('error',exception,None)</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line"><tt class="py-docstring">        ('timeout',None,None)</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line"><tt class="py-docstring">        ('terminated',None,None)</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line">        <tt class="py-name">queue</tt> <tt class="py-op">=</tt> <tt class="py-name">multiprocessing</tt><tt class="py-op">.</tt><tt class="py-name">Queue</tt><tt class="py-op">(</tt><tt class="py-name">maxsize</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line">        <tt class="py-name">p</tt> <tt class="py-op">=</tt> <tt class="py-name">multiprocessing</tt><tt class="py-op">.</tt><tt class="py-name">Process</tt><tt class="py-op">(</tt><tt class="py-name">target</tt><tt class="py-op">=</tt><tt id="link-67" class="py-name" targets="Function web2py.gluon.scheduler.executor()=web2py.gluon.scheduler-module.html#executor"><a title="web2py.gluon.scheduler.executor" class="py-name" href="#" onclick="return doclink('link-67', 'executor', 'link-67');">executor</a></tt><tt class="py-op">,</tt><tt class="py-name">args</tt><tt class="py-op">=</tt><tt class="py-op">(</tt><tt class="py-name">queue</tt><tt class="py-op">,</tt><tt class="py-name">task</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-68" class="py-name"><a title="web2py.gluon.html.FORM.process" class="py-name" href="#" onclick="return doclink('link-68', 'process', 'link-66');">process</a></tt> <tt class="py-op">=</tt> <tt class="py-name">p</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">        <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-69" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-69', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'   task starting'</tt><tt class="py-op">)</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line">        <tt class="py-name">p</tt><tt class="py-op">.</tt><tt id="link-70" class="py-name" targets="Method web2py.gluon.main.HttpServer.start()=web2py.gluon.main.HttpServer-class.html#start,Method web2py.gluon.rocket.Listener.start()=web2py.gluon.rocket.Listener-class.html#start,Method web2py.gluon.rocket.Rocket.start()=web2py.gluon.rocket.Rocket-class.html#start,Method web2py.gluon.rocket.ThreadPool.start()=web2py.gluon.rocket.ThreadPool-class.html#start,Function web2py.gluon.widget.start()=web2py.gluon.widget-module.html#start,Method web2py.gluon.widget.web2pyDialog.start()=web2py.gluon.widget.web2pyDialog-class.html#start,Method web2py.gluon.winservice.Service.start()=web2py.gluon.winservice.Service-class.html#start,Method web2py.gluon.winservice.Web2pyService.start()=web2py.gluon.winservice.Web2pyService-class.html#start"><a title="web2py.gluon.main.HttpServer.start
web2py.gluon.rocket.Listener.start
web2py.gluon.rocket.Rocket.start
web2py.gluon.rocket.ThreadPool.start
web2py.gluon.widget.start
web2py.gluon.widget.web2pyDialog.start
web2py.gluon.winservice.Service.start
web2py.gluon.winservice.Web2pyService.start" class="py-name" href="#" onclick="return doclink('link-70', 'start', 'link-70');">start</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line">            <tt class="py-name">p</tt><tt class="py-op">.</tt><tt id="link-71" class="py-name" targets="Function web2py.gluon.html.join()=web2py.gluon.html-module.html#join,Method web2py.gluon.rocket.Listener.join()=web2py.gluon.rocket.Listener-class.html#join"><a title="web2py.gluon.html.join
web2py.gluon.rocket.Listener.join" class="py-name" href="#" onclick="return doclink('link-71', 'join', 'link-71');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">timeout</tt><tt class="py-op">)</tt> </tt>
<a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line">            <tt class="py-name">p</tt><tt class="py-op">.</tt><tt class="py-name">terminate</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line">            <tt class="py-name">p</tt><tt class="py-op">.</tt><tt id="link-72" class="py-name"><a title="web2py.gluon.html.join
web2py.gluon.rocket.Listener.join" class="py-name" href="#" onclick="return doclink('link-72', 'join', 'link-71');">join</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">have_heartbeat</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line">            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-73" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-73', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'    task stopped'</tt><tt class="py-op">)</tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt id="link-74" class="py-name"><a title="web2py.gluon.scheduler.TaskReport" class="py-name" href="#" onclick="return doclink('link-74', 'TaskReport', 'link-61');">TaskReport</a></tt><tt class="py-op">(</tt><tt id="link-75" class="py-name"><a title="web2py.gluon.scheduler.STOPPED" class="py-name" href="#" onclick="return doclink('link-75', 'STOPPED', 'link-20');">STOPPED</a></tt><tt class="py-op">)</tt> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">p</tt><tt class="py-op">.</tt><tt class="py-name">is_alive</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line">            <tt class="py-name">p</tt><tt class="py-op">.</tt><tt class="py-name">terminate</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line">            <tt class="py-name">p</tt><tt class="py-op">.</tt><tt id="link-76" class="py-name"><a title="web2py.gluon.html.join
web2py.gluon.rocket.Listener.join" class="py-name" href="#" onclick="return doclink('link-76', 'join', 'link-71');">join</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line">            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-77" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-77', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'    task timeout'</tt><tt class="py-op">)</tt> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt id="link-78" class="py-name"><a title="web2py.gluon.scheduler.TaskReport" class="py-name" href="#" onclick="return doclink('link-78', 'TaskReport', 'link-61');">TaskReport</a></tt><tt class="py-op">(</tt><tt id="link-79" class="py-name"><a title="web2py.gluon.scheduler.TIMEOUT" class="py-name" href="#" onclick="return doclink('link-79', 'TIMEOUT', 'link-19');">TIMEOUT</a></tt><tt class="py-op">)</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">queue</tt><tt class="py-op">.</tt><tt class="py-name">empty</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">have_heartbeat</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line">            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-80" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-80', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'    task stopped'</tt><tt class="py-op">)</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt id="link-81" class="py-name"><a title="web2py.gluon.scheduler.TaskReport" class="py-name" href="#" onclick="return doclink('link-81', 'TaskReport', 'link-61');">TaskReport</a></tt><tt class="py-op">(</tt><tt id="link-82" class="py-name"><a title="web2py.gluon.scheduler.STOPPED" class="py-name" href="#" onclick="return doclink('link-82', 'STOPPED', 'link-20');">STOPPED</a></tt><tt class="py-op">)</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line">            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-83" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-83', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'  task completed or failed'</tt><tt class="py-op">)</tt> </tt>
<a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">queue</tt><tt class="py-op">.</tt><tt id="link-84" class="py-name" targets="Method web2py.gluon.dal.Reference.get()=web2py.gluon.dal.Reference-class.html#get"><a title="web2py.gluon.dal.Reference.get" class="py-name" href="#" onclick="return doclink('link-84', 'get', 'link-84');">get</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line"> </tt>
<a name="MetaScheduler.die"></a><div id="MetaScheduler.die-def"><a name="L212"></a><tt class="py-lineno">212</tt> <a class="py-toggle" href="#" id="MetaScheduler.die-toggle" onclick="return toggle('MetaScheduler.die');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.MetaScheduler-class.html#die">die</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="MetaScheduler.die-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MetaScheduler.die-expanded"><a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line">        <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt class="py-name">info</tt><tt class="py-op">(</tt><tt class="py-string">'die!'</tt><tt class="py-op">)</tt> </tt>
<a name="L214"></a><tt class="py-lineno">214</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">have_heartbeat</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L215"></a><tt class="py-lineno">215</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-85" class="py-name" targets="Method web2py.gluon.scheduler.MetaScheduler.terminate_process()=web2py.gluon.scheduler.MetaScheduler-class.html#terminate_process"><a title="web2py.gluon.scheduler.MetaScheduler.terminate_process" class="py-name" href="#" onclick="return doclink('link-85', 'terminate_process', 'link-85');">terminate_process</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L216"></a><tt class="py-lineno">216</tt>  <tt class="py-line"> </tt>
<a name="MetaScheduler.terminate_process"></a><div id="MetaScheduler.terminate_process-def"><a name="L217"></a><tt class="py-lineno">217</tt> <a class="py-toggle" href="#" id="MetaScheduler.terminate_process-toggle" onclick="return toggle('MetaScheduler.terminate_process');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.MetaScheduler-class.html#terminate_process">terminate_process</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="MetaScheduler.terminate_process-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MetaScheduler.terminate_process-expanded"><a name="L218"></a><tt class="py-lineno">218</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L219"></a><tt class="py-lineno">219</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-86" class="py-name"><a title="web2py.gluon.html.FORM.process" class="py-name" href="#" onclick="return doclink('link-86', 'process', 'link-66');">process</a></tt><tt class="py-op">.</tt><tt class="py-name">terminate</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L220"></a><tt class="py-lineno">220</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L221"></a><tt class="py-lineno">221</tt>  <tt class="py-line">            <tt class="py-keyword">pass</tt> <tt class="py-comment"># no process to terminate</tt> </tt>
</div><a name="L222"></a><tt class="py-lineno">222</tt>  <tt class="py-line"> </tt>
<a name="MetaScheduler.run"></a><div id="MetaScheduler.run-def"><a name="L223"></a><tt class="py-lineno">223</tt> <a class="py-toggle" href="#" id="MetaScheduler.run-toggle" onclick="return toggle('MetaScheduler.run');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.MetaScheduler-class.html#run">run</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="MetaScheduler.run-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MetaScheduler.run-expanded"><a name="L224"></a><tt class="py-lineno">224</tt>  <tt class="py-line">        <tt class="py-docstring">""" the thread that sends heartbeat """</tt> </tt>
<a name="L225"></a><tt class="py-lineno">225</tt>  <tt class="py-line">        <tt class="py-name">counter</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L226"></a><tt class="py-lineno">226</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">have_heartbeat</tt><tt class="py-op">:</tt> </tt>
<a name="L227"></a><tt class="py-lineno">227</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-87" class="py-name" targets="Method web2py.gluon.scheduler.MetaScheduler.send_heartbeat()=web2py.gluon.scheduler.MetaScheduler-class.html#send_heartbeat,Method web2py.gluon.scheduler.Scheduler.send_heartbeat()=web2py.gluon.scheduler.Scheduler-class.html#send_heartbeat"><a title="web2py.gluon.scheduler.MetaScheduler.send_heartbeat
web2py.gluon.scheduler.Scheduler.send_heartbeat" class="py-name" href="#" onclick="return doclink('link-87', 'send_heartbeat', 'link-87');">send_heartbeat</a></tt><tt class="py-op">(</tt><tt class="py-name">counter</tt><tt class="py-op">)</tt> </tt>
<a name="L228"></a><tt class="py-lineno">228</tt>  <tt class="py-line">            <tt class="py-name">counter</tt> <tt class="py-op">+=</tt> <tt class="py-number">1</tt> </tt>
</div><a name="L229"></a><tt class="py-lineno">229</tt>  <tt class="py-line"> </tt>
<a name="MetaScheduler.start_heartbeats"></a><div id="MetaScheduler.start_heartbeats-def"><a name="L230"></a><tt class="py-lineno">230</tt> <a class="py-toggle" href="#" id="MetaScheduler.start_heartbeats-toggle" onclick="return toggle('MetaScheduler.start_heartbeats');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.MetaScheduler-class.html#start_heartbeats">start_heartbeats</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="MetaScheduler.start_heartbeats-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MetaScheduler.start_heartbeats-expanded"><a name="L231"></a><tt class="py-lineno">231</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-88" class="py-name"><a title="web2py.gluon.main.HttpServer.start
web2py.gluon.rocket.Listener.start
web2py.gluon.rocket.Rocket.start
web2py.gluon.rocket.ThreadPool.start
web2py.gluon.widget.start
web2py.gluon.widget.web2pyDialog.start
web2py.gluon.winservice.Service.start
web2py.gluon.winservice.Web2pyService.start" class="py-name" href="#" onclick="return doclink('link-88', 'start', 'link-70');">start</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L232"></a><tt class="py-lineno">232</tt>  <tt class="py-line"> </tt>
<a name="MetaScheduler.send_heartbeat"></a><div id="MetaScheduler.send_heartbeat-def"><a name="L233"></a><tt class="py-lineno">233</tt> <a class="py-toggle" href="#" id="MetaScheduler.send_heartbeat-toggle" onclick="return toggle('MetaScheduler.send_heartbeat');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.MetaScheduler-class.html#send_heartbeat">send_heartbeat</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">counter</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="MetaScheduler.send_heartbeat-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MetaScheduler.send_heartbeat-expanded"><a name="L234"></a><tt class="py-lineno">234</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-string">'thum'</tt> </tt>
<a name="L235"></a><tt class="py-lineno">235</tt>  <tt class="py-line">        <tt id="link-89" class="py-name"><a title="datetime.time" class="py-name" href="#" onclick="return doclink('link-89', 'time', 'link-1');">time</a></tt><tt class="py-op">.</tt><tt id="link-90" class="py-name"><a title="web2py.gluon.scheduler.MetaScheduler.sleep
web2py.gluon.scheduler.Scheduler.sleep" class="py-name" href="#" onclick="return doclink('link-90', 'sleep', 'link-35');">sleep</a></tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
</div><a name="L236"></a><tt class="py-lineno">236</tt>  <tt class="py-line"> </tt>
<a name="MetaScheduler.pop_task"></a><div id="MetaScheduler.pop_task-def"><a name="L237"></a><tt class="py-lineno">237</tt> <a class="py-toggle" href="#" id="MetaScheduler.pop_task-toggle" onclick="return toggle('MetaScheduler.pop_task');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.MetaScheduler-class.html#pop_task">pop_task</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="MetaScheduler.pop_task-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MetaScheduler.pop_task-expanded"><a name="L238"></a><tt class="py-lineno">238</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt id="link-91" class="py-name" targets="Class web2py.gluon.scheduler.Task=web2py.gluon.scheduler.Task-class.html"><a title="web2py.gluon.scheduler.Task" class="py-name" href="#" onclick="return doclink('link-91', 'Task', 'link-91');">Task</a></tt><tt class="py-op">(</tt> </tt>
<a name="L239"></a><tt class="py-lineno">239</tt>  <tt class="py-line">            <tt class="py-name">app</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt><tt class="py-op">,</tt> </tt>
<a name="L240"></a><tt class="py-lineno">240</tt>  <tt class="py-line">            <tt class="py-name">function</tt> <tt class="py-op">=</tt> <tt class="py-string">'demo_function'</tt><tt class="py-op">,</tt> </tt>
<a name="L241"></a><tt class="py-lineno">241</tt>  <tt class="py-line">            <tt class="py-name">timeout</tt> <tt class="py-op">=</tt> <tt class="py-number">7</tt><tt class="py-op">,</tt> </tt>
<a name="L242"></a><tt class="py-lineno">242</tt>  <tt class="py-line">            <tt class="py-name">args</tt> <tt class="py-op">=</tt> <tt class="py-string">'[2]'</tt><tt class="py-op">,</tt> </tt>
<a name="L243"></a><tt class="py-lineno">243</tt>  <tt class="py-line">            <tt class="py-name">vars</tt> <tt class="py-op">=</tt> <tt class="py-string">'{}'</tt><tt class="py-op">)</tt> </tt>
</div><a name="L244"></a><tt class="py-lineno">244</tt>  <tt class="py-line"> </tt>
<a name="MetaScheduler.report_task"></a><div id="MetaScheduler.report_task-def"><a name="L245"></a><tt class="py-lineno">245</tt> <a class="py-toggle" href="#" id="MetaScheduler.report_task-toggle" onclick="return toggle('MetaScheduler.report_task');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.MetaScheduler-class.html#report_task">report_task</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">task</tt><tt class="py-op">,</tt><tt class="py-param">task_report</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="MetaScheduler.report_task-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MetaScheduler.report_task-expanded"><a name="L246"></a><tt class="py-lineno">246</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-string">'reporting task'</tt> </tt>
<a name="L247"></a><tt class="py-lineno">247</tt>  <tt class="py-line">        <tt class="py-keyword">pass</tt> </tt>
</div><a name="L248"></a><tt class="py-lineno">248</tt>  <tt class="py-line"> </tt>
<a name="MetaScheduler.sleep"></a><div id="MetaScheduler.sleep-def"><a name="L249"></a><tt class="py-lineno">249</tt> <a class="py-toggle" href="#" id="MetaScheduler.sleep-toggle" onclick="return toggle('MetaScheduler.sleep');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.MetaScheduler-class.html#sleep">sleep</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="MetaScheduler.sleep-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MetaScheduler.sleep-expanded"><a name="L250"></a><tt class="py-lineno">250</tt>  <tt class="py-line">        <tt class="py-keyword">pass</tt> </tt>
</div><a name="L251"></a><tt class="py-lineno">251</tt>  <tt class="py-line"> </tt>
<a name="MetaScheduler.loop"></a><div id="MetaScheduler.loop-def"><a name="L252"></a><tt class="py-lineno">252</tt> <a class="py-toggle" href="#" id="MetaScheduler.loop-toggle" onclick="return toggle('MetaScheduler.loop');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.MetaScheduler-class.html#loop">loop</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="MetaScheduler.loop-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MetaScheduler.loop-expanded"><a name="L253"></a><tt class="py-lineno">253</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L254"></a><tt class="py-lineno">254</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-92" class="py-name" targets="Method web2py.gluon.scheduler.MetaScheduler.start_heartbeats()=web2py.gluon.scheduler.MetaScheduler-class.html#start_heartbeats"><a title="web2py.gluon.scheduler.MetaScheduler.start_heartbeats" class="py-name" href="#" onclick="return doclink('link-92', 'start_heartbeats', 'link-92');">start_heartbeats</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L255"></a><tt class="py-lineno">255</tt>  <tt class="py-line">            <tt class="py-keyword">while</tt> <tt class="py-name">True</tt> <tt class="py-keyword">and</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">have_heartbeat</tt><tt class="py-op">:</tt> </tt>
<a name="L256"></a><tt class="py-lineno">256</tt>  <tt class="py-line">                <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-93" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-93', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'looping...'</tt><tt class="py-op">)</tt> </tt>
<a name="L257"></a><tt class="py-lineno">257</tt>  <tt class="py-line">                <tt class="py-name">task</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-94" class="py-name" targets="Method web2py.gluon.scheduler.MetaScheduler.pop_task()=web2py.gluon.scheduler.MetaScheduler-class.html#pop_task,Method web2py.gluon.scheduler.Scheduler.pop_task()=web2py.gluon.scheduler.Scheduler-class.html#pop_task"><a title="web2py.gluon.scheduler.MetaScheduler.pop_task
web2py.gluon.scheduler.Scheduler.pop_task" class="py-name" href="#" onclick="return doclink('link-94', 'pop_task', 'link-94');">pop_task</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L258"></a><tt class="py-lineno">258</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">task</tt><tt class="py-op">:</tt> </tt>
<a name="L259"></a><tt class="py-lineno">259</tt>  <tt class="py-line">                    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-95" class="py-name" targets="Method web2py.gluon.scheduler.MetaScheduler.report_task()=web2py.gluon.scheduler.MetaScheduler-class.html#report_task,Method web2py.gluon.scheduler.Scheduler.report_task()=web2py.gluon.scheduler.Scheduler-class.html#report_task"><a title="web2py.gluon.scheduler.MetaScheduler.report_task
web2py.gluon.scheduler.Scheduler.report_task" class="py-name" href="#" onclick="return doclink('link-95', 'report_task', 'link-95');">report_task</a></tt><tt class="py-op">(</tt><tt class="py-name">task</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-96" class="py-name" targets="Method web2py.gluon.scheduler.MetaScheduler.async()=web2py.gluon.scheduler.MetaScheduler-class.html#async"><a title="web2py.gluon.scheduler.MetaScheduler.async" class="py-name" href="#" onclick="return doclink('link-96', 'async', 'link-96');">async</a></tt><tt class="py-op">(</tt><tt class="py-name">task</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L260"></a><tt class="py-lineno">260</tt>  <tt class="py-line">                <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L261"></a><tt class="py-lineno">261</tt>  <tt class="py-line">                    <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-97" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-97', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'sleeping...'</tt><tt class="py-op">)</tt> </tt>
<a name="L262"></a><tt class="py-lineno">262</tt>  <tt class="py-line">                    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-98" class="py-name"><a title="web2py.gluon.scheduler.MetaScheduler.sleep
web2py.gluon.scheduler.Scheduler.sleep" class="py-name" href="#" onclick="return doclink('link-98', 'sleep', 'link-35');">sleep</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L263"></a><tt class="py-lineno">263</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">KeyboardInterrupt</tt><tt class="py-op">:</tt> </tt>
<a name="L264"></a><tt class="py-lineno">264</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-99" class="py-name" targets="Method web2py.gluon.scheduler.MetaScheduler.die()=web2py.gluon.scheduler.MetaScheduler-class.html#die,Function web2py.gluon.shell.die()=web2py.gluon.shell-module.html#die"><a title="web2py.gluon.scheduler.MetaScheduler.die
web2py.gluon.shell.die" class="py-name" href="#" onclick="return doclink('link-99', 'die', 'link-99');">die</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L265"></a><tt class="py-lineno">265</tt>  <tt class="py-line"> </tt>
<a name="L266"></a><tt class="py-lineno">266</tt>  <tt class="py-line"> </tt>
<a name="L267"></a><tt class="py-lineno">267</tt>  <tt class="py-line"><tt id="link-100" class="py-name" targets="Variable web2py.gluon.scheduler.TASK_STATUS=web2py.gluon.scheduler-module.html#TASK_STATUS"><a title="web2py.gluon.scheduler.TASK_STATUS" class="py-name" href="#" onclick="return doclink('link-100', 'TASK_STATUS', 'link-100');">TASK_STATUS</a></tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt id="link-101" class="py-name"><a title="web2py.gluon.scheduler.QUEUED" class="py-name" href="#" onclick="return doclink('link-101', 'QUEUED', 'link-14');">QUEUED</a></tt><tt class="py-op">,</tt> <tt id="link-102" class="py-name"><a title="web2py.gluon.scheduler.RUNNING" class="py-name" href="#" onclick="return doclink('link-102', 'RUNNING', 'link-16');">RUNNING</a></tt><tt class="py-op">,</tt> <tt id="link-103" class="py-name"><a title="web2py.gluon.scheduler.COMPLETED" class="py-name" href="#" onclick="return doclink('link-103', 'COMPLETED', 'link-17');">COMPLETED</a></tt><tt class="py-op">,</tt> <tt id="link-104" class="py-name"><a title="web2py.gluon.scheduler.FAILED" class="py-name" href="#" onclick="return doclink('link-104', 'FAILED', 'link-18');">FAILED</a></tt><tt class="py-op">,</tt> <tt id="link-105" class="py-name"><a title="web2py.gluon.scheduler.TIMEOUT" class="py-name" href="#" onclick="return doclink('link-105', 'TIMEOUT', 'link-19');">TIMEOUT</a></tt><tt class="py-op">,</tt> <tt id="link-106" class="py-name"><a title="web2py.gluon.scheduler.STOPPED" class="py-name" href="#" onclick="return doclink('link-106', 'STOPPED', 'link-20');">STOPPED</a></tt><tt class="py-op">)</tt> </tt>
<a name="L268"></a><tt class="py-lineno">268</tt>  <tt class="py-line"><tt id="link-107" class="py-name" targets="Variable web2py.gluon.scheduler.RUN_STATUS=web2py.gluon.scheduler-module.html#RUN_STATUS"><a title="web2py.gluon.scheduler.RUN_STATUS" class="py-name" href="#" onclick="return doclink('link-107', 'RUN_STATUS', 'link-107');">RUN_STATUS</a></tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt id="link-108" class="py-name"><a title="web2py.gluon.scheduler.RUNNING" class="py-name" href="#" onclick="return doclink('link-108', 'RUNNING', 'link-16');">RUNNING</a></tt><tt class="py-op">,</tt> <tt id="link-109" class="py-name"><a title="web2py.gluon.scheduler.COMPLETED" class="py-name" href="#" onclick="return doclink('link-109', 'COMPLETED', 'link-17');">COMPLETED</a></tt><tt class="py-op">,</tt> <tt id="link-110" class="py-name"><a title="web2py.gluon.scheduler.FAILED" class="py-name" href="#" onclick="return doclink('link-110', 'FAILED', 'link-18');">FAILED</a></tt><tt class="py-op">,</tt> <tt id="link-111" class="py-name"><a title="web2py.gluon.scheduler.TIMEOUT" class="py-name" href="#" onclick="return doclink('link-111', 'TIMEOUT', 'link-19');">TIMEOUT</a></tt><tt class="py-op">,</tt> <tt id="link-112" class="py-name"><a title="web2py.gluon.scheduler.STOPPED" class="py-name" href="#" onclick="return doclink('link-112', 'STOPPED', 'link-20');">STOPPED</a></tt><tt class="py-op">)</tt> </tt>
<a name="L269"></a><tt class="py-lineno">269</tt>  <tt class="py-line"><tt id="link-113" class="py-name" targets="Variable web2py.gluon.scheduler.WORKER_STATUS=web2py.gluon.scheduler-module.html#WORKER_STATUS"><a title="web2py.gluon.scheduler.WORKER_STATUS" class="py-name" href="#" onclick="return doclink('link-113', 'WORKER_STATUS', 'link-113');">WORKER_STATUS</a></tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt id="link-114" class="py-name"><a title="web2py.gluon.scheduler.ACTIVE" class="py-name" href="#" onclick="return doclink('link-114', 'ACTIVE', 'link-21');">ACTIVE</a></tt><tt class="py-op">,</tt><tt id="link-115" class="py-name"><a title="web2py.gluon.scheduler.INACTIVE" class="py-name" href="#" onclick="return doclink('link-115', 'INACTIVE', 'link-22');">INACTIVE</a></tt><tt class="py-op">,</tt><tt id="link-116" class="py-name"><a title="web2py.gluon.scheduler.DISABLED" class="py-name" href="#" onclick="return doclink('link-116', 'DISABLED', 'link-23');">DISABLED</a></tt><tt class="py-op">)</tt> </tt>
<a name="L270"></a><tt class="py-lineno">270</tt>  <tt class="py-line"> </tt>
<a name="TYPE"></a><div id="TYPE-def"><a name="L271"></a><tt class="py-lineno">271</tt> <a class="py-toggle" href="#" id="TYPE-toggle" onclick="return toggle('TYPE');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="web2py.gluon.scheduler.TYPE-class.html">TYPE</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TYPE-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="TYPE-expanded"><a name="L272"></a><tt class="py-lineno">272</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L273"></a><tt class="py-lineno">273</tt>  <tt class="py-line"><tt class="py-docstring">    validator that check whether field is valid json and validate its type</tt> </tt>
<a name="L274"></a><tt class="py-lineno">274</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L275"></a><tt class="py-lineno">275</tt>  <tt class="py-line"> </tt>
<a name="TYPE.__init__"></a><div id="TYPE.__init__-def"><a name="L276"></a><tt class="py-lineno">276</tt> <a class="py-toggle" href="#" id="TYPE.__init__-toggle" onclick="return toggle('TYPE.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.TYPE-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">myclass</tt><tt class="py-op">=</tt><tt class="py-name">list</tt><tt class="py-op">,</tt><tt class="py-param">parse</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TYPE.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TYPE.__init__-expanded"><a name="L277"></a><tt class="py-lineno">277</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">myclass</tt> <tt class="py-op">=</tt> <tt class="py-name">myclass</tt> </tt>
<a name="L278"></a><tt class="py-lineno">278</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-117" class="py-name" targets="Method web2py.gluon.dal.BaseAdapter.parse()=web2py.gluon.dal.BaseAdapter-class.html#parse,Method web2py.gluon.template.TemplateParser.parse()=web2py.gluon.template.TemplateParser-class.html#parse"><a title="web2py.gluon.dal.BaseAdapter.parse
web2py.gluon.template.TemplateParser.parse" class="py-name" href="#" onclick="return doclink('link-117', 'parse', 'link-117');">parse</a></tt><tt class="py-op">=</tt><tt id="link-118" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.parse
web2py.gluon.template.TemplateParser.parse" class="py-name" href="#" onclick="return doclink('link-118', 'parse', 'link-117');">parse</a></tt> </tt>
</div><a name="L279"></a><tt class="py-lineno">279</tt>  <tt class="py-line"> </tt>
<a name="TYPE.__call__"></a><div id="TYPE.__call__-def"><a name="L280"></a><tt class="py-lineno">280</tt> <a class="py-toggle" href="#" id="TYPE.__call__-toggle" onclick="return toggle('TYPE.__call__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.TYPE-class.html#__call__">__call__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">value</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TYPE.__call__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TYPE.__call__-expanded"><a name="L281"></a><tt class="py-lineno">281</tt>  <tt class="py-line">        <tt class="py-keyword">from</tt> <tt id="link-119" class="py-name"><a title="web2py.gluon" class="py-name" href="#" onclick="return doclink('link-119', 'gluon', 'link-4');">gluon</a></tt> <tt class="py-keyword">import</tt> <tt id="link-120" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-120', 'current', 'link-51');">current</a></tt> </tt>
<a name="L282"></a><tt class="py-lineno">282</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L283"></a><tt class="py-lineno">283</tt>  <tt class="py-line">            <tt class="py-name">obj</tt> <tt class="py-op">=</tt> <tt class="py-name">loads</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">)</tt> </tt>
<a name="L284"></a><tt class="py-lineno">284</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L285"></a><tt class="py-lineno">285</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">,</tt><tt id="link-121" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-121', 'current', 'link-51');">current</a></tt><tt class="py-op">.</tt><tt id="link-122" class="py-name" targets="Variable web2py.gluon.T=web2py.gluon-module.html#T,Variable web2py.gluon.languages.lazyT.T=web2py.gluon.languages.lazyT-class.html#T"><a title="web2py.gluon.T
web2py.gluon.languages.lazyT.T" class="py-name" href="#" onclick="return doclink('link-122', 'T', 'link-122');">T</a></tt><tt class="py-op">(</tt><tt class="py-string">'invalid json'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L286"></a><tt class="py-lineno">286</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L287"></a><tt class="py-lineno">287</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">obj</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">myclass</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L288"></a><tt class="py-lineno">288</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-123" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.parse
web2py.gluon.template.TemplateParser.parse" class="py-name" href="#" onclick="return doclink('link-123', 'parse', 'link-117');">parse</a></tt><tt class="py-op">:</tt> </tt>
<a name="L289"></a><tt class="py-lineno">289</tt>  <tt class="py-line">                    <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">obj</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
<a name="L290"></a><tt class="py-lineno">290</tt>  <tt class="py-line">                <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L291"></a><tt class="py-lineno">291</tt>  <tt class="py-line">                    <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
<a name="L292"></a><tt class="py-lineno">292</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L293"></a><tt class="py-lineno">293</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">,</tt><tt id="link-124" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-124', 'current', 'link-51');">current</a></tt><tt class="py-op">.</tt><tt id="link-125" class="py-name"><a title="web2py.gluon.T
web2py.gluon.languages.lazyT.T" class="py-name" href="#" onclick="return doclink('link-125', 'T', 'link-122');">T</a></tt><tt class="py-op">(</tt><tt class="py-string">'Not of type: %s'</tt><tt class="py-op">)</tt> <tt class="py-op">%</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">myclass</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L294"></a><tt class="py-lineno">294</tt>  <tt class="py-line"> </tt>
<a name="Scheduler"></a><div id="Scheduler-def"><a name="L295"></a><tt class="py-lineno">295</tt> <a class="py-toggle" href="#" id="Scheduler-toggle" onclick="return toggle('Scheduler');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="web2py.gluon.scheduler.Scheduler-class.html">Scheduler</a><tt class="py-op">(</tt><tt class="py-base-class">MetaScheduler</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Scheduler-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Scheduler-expanded"><a name="Scheduler.__init__"></a><div id="Scheduler.__init__-def"><a name="L296"></a><tt class="py-lineno">296</tt> <a class="py-toggle" href="#" id="Scheduler.__init__-toggle" onclick="return toggle('Scheduler.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.Scheduler-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">db</tt><tt class="py-op">,</tt><tt class="py-param">tasks</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">,</tt><tt class="py-param">migrate</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> </tt>
<a name="L297"></a><tt class="py-lineno">297</tt>  <tt class="py-line">                 <tt class="py-param">worker_name</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-param">group_names</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-param">heartbeat</tt><tt class="py-op">=</tt><tt id="link-126" class="py-name"><a title="web2py.gluon.scheduler.HEARTBEAT" class="py-name" href="#" onclick="return doclink('link-126', 'HEARTBEAT', 'link-25');">HEARTBEAT</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Scheduler.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Scheduler.__init__-expanded"><a name="L298"></a><tt class="py-lineno">298</tt>  <tt class="py-line"> </tt>
<a name="L299"></a><tt class="py-lineno">299</tt>  <tt class="py-line">        <tt id="link-127" class="py-name" targets="Class web2py.gluon.scheduler.MetaScheduler=web2py.gluon.scheduler.MetaScheduler-class.html"><a title="web2py.gluon.scheduler.MetaScheduler" class="py-name" href="#" onclick="return doclink('link-127', 'MetaScheduler', 'link-127');">MetaScheduler</a></tt><tt class="py-op">.</tt><tt id="link-128" class="py-name"><a title="web2py.gluon.cache.Cache.__init__
web2py.gluon.cache.CacheAbstract.__init__
web2py.gluon.cache.CacheInRam.__init__
web2py.gluon.cache.CacheOnDisk.__init__
web2py.gluon.compileapp.LoadFactory.__init__
web2py.gluon.custom_import._DateTrackerImporter.__init__
web2py.gluon.custom_import._Web2pyImporter.__init__
web2py.gluon.dal.BaseAdapter.__init__
web2py.gluon.dal.CouchDBAdapter.__init__
web2py.gluon.dal.CubridAdapter.__init__
web2py.gluon.dal.DAL.__init__
web2py.gluon.dal.DB2Adapter.__init__
web2py.gluon.dal.DatabaseStoredFile.__init__
web2py.gluon.dal.Expression.__init__
web2py.gluon.dal.Field.__init__
web2py.gluon.dal.FieldLazy.__init__
web2py.gluon.dal.FieldVirtual.__init__
web2py.gluon.dal.FireBirdAdapter.__init__
web2py.gluon.dal.FireBirdEmbeddedAdapter.__init__
web2py.gluon.dal.GAEDecimalProperty.__init__
web2py.gluon.dal.GAEF.__init__
web2py.gluon.dal.GoogleDatastoreAdapter.__init__
web2py.gluon.dal.GoogleSQLAdapter.__init__
web2py.gluon.dal.IMAPAdapter.__init__
web2py.gluon.dal.InformixAdapter.__init__
web2py.gluon.dal.IngresAdapter.__init__
web2py.gluon.dal.JDBCPostgreSQLAdapter.__init__
web2py.gluon.dal.JDBCSQLiteAdapter.__init__
web2py.gluon.dal.MSSQLAdapter.__init__
web2py.gluon.dal.MongoDBAdapter.__init__
web2py.gluon.dal.MySQLAdapter.__init__
web2py.gluon.dal.OracleAdapter.__init__
web2py.gluon.dal.PostgreSQLAdapter.__init__
web2py.gluon.dal.Query.__init__
web2py.gluon.dal.Rows.__init__
web2py.gluon.dal.SAPDBAdapter.__init__
web2py.gluon.dal.SQLALL.__init__
web2py.gluon.dal.SQLCustomType.__init__
web2py.gluon.dal.SQLiteAdapter.__init__
web2py.gluon.dal.Set.__init__
web2py.gluon.dal.Table.__init__
web2py.gluon.dal.TeradataAdapter.__init__
web2py.gluon.dal.VirtualCommand.__init__
web2py.gluon.debug.Pipe.__init__
web2py.gluon.debug.WebDebugger.__init__
web2py.gluon.globals.Request.__init__
web2py.gluon.globals.Response.__init__
web2py.gluon.highlight.Highlighter.__init__
web2py.gluon.html.BEAUTIFY.__init__
web2py.gluon.html.DIV.__init__
web2py.gluon.html.FORM.__init__
web2py.gluon.html.MARKMIN.__init__
web2py.gluon.html.MENU.__init__
web2py.gluon.html.XML.__init__
web2py.gluon.html.web2pyHTMLParser.__init__
web2py.gluon.http.HTTP.__init__
web2py.gluon.languages.lazyT.__init__
web2py.gluon.languages.translator.__init__
web2py.gluon.main.HttpServer.__init__
web2py.gluon.newcron.Token.__init__
web2py.gluon.newcron.cronlauncher.__init__
web2py.gluon.newcron.extcron.__init__
web2py.gluon.newcron.hardcron.__init__
web2py.gluon.newcron.softcron.__init__
web2py.gluon.portalocker.LockedFile.__init__
web2py.gluon.restricted.RestrictedError.__init__
web2py.gluon.restricted.TicketStorage.__init__
web2py.gluon.rewrite.MapUrlIn.__init__
web2py.gluon.rewrite.MapUrlOut.__init__
web2py.gluon.rocket.ChunkedReader.__init__
web2py.gluon.rocket.Connection.__init__
web2py.gluon.rocket.FileLikeSocket.__init__
web2py.gluon.rocket.FileSystemWorker.__init__
web2py.gluon.rocket.FuturesMiddleware.__init__
web2py.gluon.rocket.LimitingFileWrapper.__init__
web2py.gluon.rocket.Listener.__init__
web2py.gluon.rocket.Monitor.__init__
web2py.gluon.rocket.Rocket.__init__
web2py.gluon.rocket.ThreadPool.__init__
web2py.gluon.rocket.WSGIExecutor.__init__
web2py.gluon.rocket.WSGIFuture.__init__
web2py.gluon.rocket.WSGIWorker.__init__
web2py.gluon.rocket.Worker.__init__
web2py.gluon.rocket._WorkItem.__init__
web2py.gluon.sanitizer.XssCleaner.__init__
web2py.gluon.scheduler.MetaScheduler.__init__
web2py.gluon.scheduler.Scheduler.__init__
web2py.gluon.scheduler.TYPE.__init__
web2py.gluon.scheduler.Task.__init__
web2py.gluon.scheduler.TaskReport.__init__
web2py.gluon.sqlhtml.AutocompleteWidget.__init__
web2py.gluon.sqlhtml.SQLFORM.__init__
web2py.gluon.sqlhtml.SQLTABLE.__init__
web2py.gluon.storage.Messages.__init__
web2py.gluon.template.BlockNode.__init__
web2py.gluon.template.Content.__init__
web2py.gluon.template.Node.__init__
web2py.gluon.template.SuperNode.__init__
web2py.gluon.template.TemplateParser.__init__
web2py.gluon.tools.Auth.__init__
web2py.gluon.tools.Crud.__init__
web2py.gluon.tools.Expose.__init__
web2py.gluon.tools.Mail.Attachment.__init__
web2py.gluon.tools.Mail.__init__
web2py.gluon.tools.PluginManager.__init__
web2py.gluon.tools.Recaptcha.__init__
web2py.gluon.tools.Service.JsonRpcException.__init__
web2py.gluon.tools.Service.__init__
web2py.gluon.validators.CLEANUP.__init__
web2py.gluon.validators.CRYPT.__init__
web2py.gluon.validators.IS_ALPHANUMERIC.__init__
web2py.gluon.validators.IS_DATE.__init__
web2py.gluon.validators.IS_DATETIME.__init__
web2py.gluon.validators.IS_DATETIME_IN_RANGE.__init__
web2py.gluon.validators.IS_DATE_IN_RANGE.__init__
web2py.gluon.validators.IS_DECIMAL_IN_RANGE.__init__
web2py.gluon.validators.IS_EMAIL.__init__
web2py.gluon.validators.IS_EMPTY_OR.__init__
web2py.gluon.validators.IS_EQUAL_TO.__init__
web2py.gluon.validators.IS_EXPR.__init__
web2py.gluon.validators.IS_FLOAT_IN_RANGE.__init__
web2py.gluon.validators.IS_GENERIC_URL.__init__
web2py.gluon.validators.IS_HTTP_URL.__init__
web2py.gluon.validators.IS_IMAGE.__init__
web2py.gluon.validators.IS_INT_IN_RANGE.__init__
web2py.gluon.validators.IS_IN_DB.__init__
web2py.gluon.validators.IS_IN_SET.__init__
web2py.gluon.validators.IS_IN_SUBSET.__init__
web2py.gluon.validators.IS_IPV4.__init__
web2py.gluon.validators.IS_LENGTH.__init__
web2py.gluon.validators.IS_LIST_OF.__init__
web2py.gluon.validators.IS_MATCH.__init__
web2py.gluon.validators.IS_NOT_EMPTY.__init__
web2py.gluon.validators.IS_NOT_IN_DB.__init__
web2py.gluon.validators.IS_SLUG.__init__
web2py.gluon.validators.IS_STRONG.__init__
web2py.gluon.validators.IS_TIME.__init__
web2py.gluon.validators.IS_UPLOAD_FILENAME.__init__
web2py.gluon.validators.IS_URL.__init__
web2py.gluon.widget.IO.__init__
web2py.gluon.widget.web2pyDialog.__init__
web2py.gluon.winservice.Service.__init__" class="py-name" href="#" onclick="return doclink('link-128', '__init__', 'link-65');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
<a name="L300"></a><tt class="py-lineno">300</tt>  <tt class="py-line"> </tt>
<a name="L301"></a><tt class="py-lineno">301</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt> <tt class="py-op">=</tt> <tt class="py-name">db</tt> </tt>
<a name="L302"></a><tt class="py-lineno">302</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db_thread</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L303"></a><tt class="py-lineno">303</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">tasks</tt> <tt class="py-op">=</tt> <tt class="py-name">tasks</tt> </tt>
<a name="L304"></a><tt class="py-lineno">304</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">group_names</tt> <tt class="py-op">=</tt> <tt class="py-name">group_names</tt> <tt class="py-keyword">or</tt> <tt class="py-op">[</tt><tt class="py-string">'main'</tt><tt class="py-op">]</tt> </tt>
<a name="L305"></a><tt class="py-lineno">305</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">heartbeat</tt> <tt class="py-op">=</tt> <tt class="py-name">heartbeat</tt> </tt>
<a name="L306"></a><tt class="py-lineno">306</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">worker_name</tt> <tt class="py-op">=</tt> <tt class="py-name">worker_name</tt> <tt class="py-keyword">or</tt> <tt id="link-129" class="py-name"><a title="web2py.gluon.rocket.Connection.socket" class="py-name" href="#" onclick="return doclink('link-129', 'socket', 'link-2');">socket</a></tt><tt class="py-op">.</tt><tt class="py-name">gethostname</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">+</tt><tt class="py-string">'#'</tt><tt class="py-op">+</tt><tt class="py-name">str</tt><tt class="py-op">(</tt><tt id="link-130" class="py-name"><a title="web2py.gluon.utils.web2py_uuid" class="py-name" href="#" onclick="return doclink('link-130', 'web2py_uuid', 'link-13');">web2py_uuid</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L307"></a><tt class="py-lineno">307</tt>  <tt class="py-line"> </tt>
<a name="L308"></a><tt class="py-lineno">308</tt>  <tt class="py-line">        <tt class="py-keyword">from</tt> <tt id="link-131" class="py-name"><a title="web2py.gluon" class="py-name" href="#" onclick="return doclink('link-131', 'gluon', 'link-4');">gluon</a></tt> <tt class="py-keyword">import</tt> <tt id="link-132" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-132', 'current', 'link-51');">current</a></tt> </tt>
<a name="L309"></a><tt class="py-lineno">309</tt>  <tt class="py-line">        <tt id="link-133" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-133', 'current', 'link-51');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">_scheduler</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt> </tt>
<a name="L310"></a><tt class="py-lineno">310</tt>  <tt class="py-line"> </tt>
<a name="L311"></a><tt class="py-lineno">311</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-134" class="py-name" targets="Method web2py.gluon.dal.IMAPAdapter.define_tables()=web2py.gluon.dal.IMAPAdapter-class.html#define_tables,Method web2py.gluon.scheduler.Scheduler.define_tables()=web2py.gluon.scheduler.Scheduler-class.html#define_tables,Method web2py.gluon.tools.Auth.define_tables()=web2py.gluon.tools.Auth-class.html#define_tables"><a title="web2py.gluon.dal.IMAPAdapter.define_tables
web2py.gluon.scheduler.Scheduler.define_tables
web2py.gluon.tools.Auth.define_tables" class="py-name" href="#" onclick="return doclink('link-134', 'define_tables', 'link-134');">define_tables</a></tt><tt class="py-op">(</tt><tt class="py-name">db</tt><tt class="py-op">,</tt><tt class="py-name">migrate</tt><tt class="py-op">=</tt><tt class="py-name">migrate</tt><tt class="py-op">)</tt> </tt>
</div><a name="L312"></a><tt class="py-lineno">312</tt>  <tt class="py-line"> </tt>
<a name="Scheduler.define_tables"></a><div id="Scheduler.define_tables-def"><a name="L313"></a><tt class="py-lineno">313</tt> <a class="py-toggle" href="#" id="Scheduler.define_tables-toggle" onclick="return toggle('Scheduler.define_tables');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.Scheduler-class.html#define_tables">define_tables</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">db</tt><tt class="py-op">,</tt><tt class="py-param">migrate</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Scheduler.define_tables-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Scheduler.define_tables-expanded"><a name="L314"></a><tt class="py-lineno">314</tt>  <tt class="py-line">        <tt class="py-keyword">from</tt> <tt id="link-135" class="py-name"><a title="web2py.gluon" class="py-name" href="#" onclick="return doclink('link-135', 'gluon', 'link-4');">gluon</a></tt> <tt class="py-keyword">import</tt> <tt id="link-136" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-136', 'current', 'link-51');">current</a></tt> </tt>
<a name="L315"></a><tt class="py-lineno">315</tt>  <tt class="py-line">        <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-137" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-137', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'defining tables (migrate=%s)'</tt> <tt class="py-op">%</tt> <tt class="py-name">migrate</tt><tt class="py-op">)</tt> </tt>
<a name="L316"></a><tt class="py-lineno">316</tt>  <tt class="py-line">        <tt class="py-name">now</tt> <tt class="py-op">=</tt> <tt id="link-138" class="py-name"><a title="datetime.datetime" class="py-name" href="#" onclick="return doclink('link-138', 'datetime', 'link-3');">datetime</a></tt><tt class="py-op">.</tt><tt id="link-139" class="py-name"><a title="datetime.datetime" class="py-name" href="#" onclick="return doclink('link-139', 'datetime', 'link-3');">datetime</a></tt><tt class="py-op">.</tt><tt class="py-name">now</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L317"></a><tt class="py-lineno">317</tt>  <tt class="py-line">        <tt class="py-name">db</tt><tt class="py-op">.</tt><tt id="link-140" class="py-name" targets="Method web2py.gluon.dal.DAL.define_table()=web2py.gluon.dal.DAL-class.html#define_table"><a title="web2py.gluon.dal.DAL.define_table" class="py-name" href="#" onclick="return doclink('link-140', 'define_table', 'link-140');">define_table</a></tt><tt class="py-op">(</tt> </tt>
<a name="L318"></a><tt class="py-lineno">318</tt>  <tt class="py-line">            <tt class="py-string">'scheduler_task'</tt><tt class="py-op">,</tt> </tt>
<a name="L319"></a><tt class="py-lineno">319</tt>  <tt class="py-line">            <tt id="link-141" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-141', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'application_name'</tt><tt class="py-op">,</tt><tt id="link-142" class="py-name" targets="Method web2py.gluon.tools.Auth.requires()=web2py.gluon.tools.Auth-class.html#requires"><a title="web2py.gluon.tools.Auth.requires" class="py-name" href="#" onclick="return doclink('link-142', 'requires', 'link-142');">requires</a></tt><tt class="py-op">=</tt><tt id="link-143" class="py-name"><a title="web2py.gluon.validators.IS_NOT_EMPTY" class="py-name" href="#" onclick="return doclink('link-143', 'IS_NOT_EMPTY', 'link-9');">IS_NOT_EMPTY</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L320"></a><tt class="py-lineno">320</tt>  <tt class="py-line">                  <tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-name">writable</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L321"></a><tt class="py-lineno">321</tt>  <tt class="py-line">            <tt id="link-144" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-144', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'task_name'</tt><tt class="py-op">,</tt><tt id="link-145" class="py-name"><a title="web2py.gluon.tools.Auth.requires" class="py-name" href="#" onclick="return doclink('link-145', 'requires', 'link-142');">requires</a></tt><tt class="py-op">=</tt><tt id="link-146" class="py-name"><a title="web2py.gluon.validators.IS_NOT_EMPTY" class="py-name" href="#" onclick="return doclink('link-146', 'IS_NOT_EMPTY', 'link-9');">IS_NOT_EMPTY</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L322"></a><tt class="py-lineno">322</tt>  <tt class="py-line">            <tt id="link-147" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-147', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'group_name'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-string">'main'</tt><tt class="py-op">,</tt><tt class="py-name">writable</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L323"></a><tt class="py-lineno">323</tt>  <tt class="py-line">            <tt id="link-148" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-148', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'status'</tt><tt class="py-op">,</tt><tt id="link-149" class="py-name"><a title="web2py.gluon.tools.Auth.requires" class="py-name" href="#" onclick="return doclink('link-149', 'requires', 'link-142');">requires</a></tt><tt class="py-op">=</tt><tt id="link-150" class="py-name"><a title="web2py.gluon.validators.IS_IN_SET" class="py-name" href="#" onclick="return doclink('link-150', 'IS_IN_SET', 'link-10');">IS_IN_SET</a></tt><tt class="py-op">(</tt><tt id="link-151" class="py-name"><a title="web2py.gluon.scheduler.TASK_STATUS" class="py-name" href="#" onclick="return doclink('link-151', 'TASK_STATUS', 'link-100');">TASK_STATUS</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L324"></a><tt class="py-lineno">324</tt>  <tt class="py-line">                  <tt class="py-name">default</tt><tt class="py-op">=</tt><tt id="link-152" class="py-name"><a title="web2py.gluon.scheduler.QUEUED" class="py-name" href="#" onclick="return doclink('link-152', 'QUEUED', 'link-14');">QUEUED</a></tt><tt class="py-op">,</tt><tt class="py-name">writable</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L325"></a><tt class="py-lineno">325</tt>  <tt class="py-line">            <tt id="link-153" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-153', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'function_name'</tt><tt class="py-op">,</tt> </tt>
<a name="L326"></a><tt class="py-lineno">326</tt>  <tt class="py-line">                  <tt id="link-154" class="py-name"><a title="web2py.gluon.tools.Auth.requires" class="py-name" href="#" onclick="return doclink('link-154', 'requires', 'link-142');">requires</a></tt><tt class="py-op">=</tt><tt id="link-155" class="py-name"><a title="web2py.gluon.validators.IS_IN_SET" class="py-name" href="#" onclick="return doclink('link-155', 'IS_IN_SET', 'link-10');">IS_IN_SET</a></tt><tt class="py-op">(</tt><tt class="py-name">sorted</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">tasks</tt><tt class="py-op">.</tt><tt id="link-156" class="py-name" targets="Method web2py.gluon.tools.PluginManager.keys()=web2py.gluon.tools.PluginManager-class.html#keys"><a title="web2py.gluon.tools.PluginManager.keys" class="py-name" href="#" onclick="return doclink('link-156', 'keys', 'link-156');">keys</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L327"></a><tt class="py-lineno">327</tt>  <tt class="py-line">            <tt id="link-157" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-157', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'args'</tt><tt class="py-op">,</tt><tt class="py-string">'text'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-string">'[]'</tt><tt class="py-op">,</tt><tt id="link-158" class="py-name"><a title="web2py.gluon.tools.Auth.requires" class="py-name" href="#" onclick="return doclink('link-158', 'requires', 'link-142');">requires</a></tt><tt class="py-op">=</tt><tt id="link-159" class="py-name" targets="Class web2py.gluon.scheduler.TYPE=web2py.gluon.scheduler.TYPE-class.html"><a title="web2py.gluon.scheduler.TYPE" class="py-name" href="#" onclick="return doclink('link-159', 'TYPE', 'link-159');">TYPE</a></tt><tt class="py-op">(</tt><tt class="py-name">list</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L328"></a><tt class="py-lineno">328</tt>  <tt class="py-line">            <tt id="link-160" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-160', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'vars'</tt><tt class="py-op">,</tt><tt class="py-string">'text'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-string">'{}'</tt><tt class="py-op">,</tt><tt id="link-161" class="py-name"><a title="web2py.gluon.tools.Auth.requires" class="py-name" href="#" onclick="return doclink('link-161', 'requires', 'link-142');">requires</a></tt><tt class="py-op">=</tt><tt id="link-162" class="py-name"><a title="web2py.gluon.scheduler.TYPE" class="py-name" href="#" onclick="return doclink('link-162', 'TYPE', 'link-159');">TYPE</a></tt><tt class="py-op">(</tt><tt class="py-name">dict</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L329"></a><tt class="py-lineno">329</tt>  <tt class="py-line">            <tt id="link-163" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-163', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'enabled'</tt><tt class="py-op">,</tt><tt class="py-string">'boolean'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L330"></a><tt class="py-lineno">330</tt>  <tt class="py-line">            <tt id="link-164" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-164', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'start_time'</tt><tt class="py-op">,</tt><tt class="py-string">'datetime'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">now</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L331"></a><tt class="py-lineno">331</tt>  <tt class="py-line">            <tt id="link-165" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-165', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'next_run_time'</tt><tt class="py-op">,</tt><tt class="py-string">'datetime'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">now</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L332"></a><tt class="py-lineno">332</tt>  <tt class="py-line">            <tt id="link-166" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-166', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'stop_time'</tt><tt class="py-op">,</tt><tt class="py-string">'datetime'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">now</tt><tt class="py-op">+</tt><tt id="link-167" class="py-name"><a title="datetime.datetime" class="py-name" href="#" onclick="return doclink('link-167', 'datetime', 'link-3');">datetime</a></tt><tt class="py-op">.</tt><tt class="py-name">timedelta</tt><tt class="py-op">(</tt><tt class="py-name">days</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L333"></a><tt class="py-lineno">333</tt>  <tt class="py-line">            <tt id="link-168" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-168', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'repeats'</tt><tt class="py-op">,</tt><tt class="py-string">'integer'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">,</tt><tt class="py-name">comment</tt><tt class="py-op">=</tt><tt class="py-string">"0=unlimted"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L334"></a><tt class="py-lineno">334</tt>  <tt class="py-line">            <tt id="link-169" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-169', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'period'</tt><tt class="py-op">,</tt><tt class="py-string">'integer'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-number">60</tt><tt class="py-op">,</tt><tt class="py-name">comment</tt><tt class="py-op">=</tt><tt class="py-string">'seconds'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L335"></a><tt class="py-lineno">335</tt>  <tt class="py-line">            <tt id="link-170" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-170', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'timeout'</tt><tt class="py-op">,</tt><tt class="py-string">'integer'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-number">60</tt><tt class="py-op">,</tt><tt class="py-name">comment</tt><tt class="py-op">=</tt><tt class="py-string">'seconds'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L336"></a><tt class="py-lineno">336</tt>  <tt class="py-line">            <tt id="link-171" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-171', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'times_run'</tt><tt class="py-op">,</tt><tt class="py-string">'integer'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">,</tt><tt class="py-name">writable</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L337"></a><tt class="py-lineno">337</tt>  <tt class="py-line">            <tt id="link-172" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-172', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'last_run_time'</tt><tt class="py-op">,</tt><tt class="py-string">'datetime'</tt><tt class="py-op">,</tt><tt class="py-name">writable</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt><tt class="py-name">readable</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L338"></a><tt class="py-lineno">338</tt>  <tt class="py-line">            <tt id="link-173" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-173', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'assigned_worker_name'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">,</tt><tt class="py-name">writable</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L339"></a><tt class="py-lineno">339</tt>  <tt class="py-line">            <tt class="py-name">migrate</tt><tt class="py-op">=</tt><tt class="py-name">migrate</tt><tt class="py-op">,</tt><tt class="py-name">format</tt><tt class="py-op">=</tt><tt class="py-string">'%(task_name)s'</tt><tt class="py-op">)</tt> </tt>
<a name="L340"></a><tt class="py-lineno">340</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt id="link-174" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-174', 'current', 'link-51');">current</a></tt><tt class="py-op">,</tt><tt class="py-string">'request'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L341"></a><tt class="py-lineno">341</tt>  <tt class="py-line">            <tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">scheduler_task</tt><tt class="py-op">.</tt><tt class="py-name">application_name</tt><tt class="py-op">.</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt id="link-175" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-175', 'current', 'link-51');">current</a></tt><tt class="py-op">.</tt><tt id="link-176" class="py-name" targets="Variable web2py.gluon.request=web2py.gluon-module.html#request"><a title="web2py.gluon.request" class="py-name" href="#" onclick="return doclink('link-176', 'request', 'link-176');">request</a></tt><tt class="py-op">.</tt><tt class="py-name">application</tt> </tt>
<a name="L342"></a><tt class="py-lineno">342</tt>  <tt class="py-line"> </tt>
<a name="L343"></a><tt class="py-lineno">343</tt>  <tt class="py-line">        <tt class="py-name">db</tt><tt class="py-op">.</tt><tt id="link-177" class="py-name"><a title="web2py.gluon.dal.DAL.define_table" class="py-name" href="#" onclick="return doclink('link-177', 'define_table', 'link-140');">define_table</a></tt><tt class="py-op">(</tt> </tt>
<a name="L344"></a><tt class="py-lineno">344</tt>  <tt class="py-line">            <tt class="py-string">'scheduler_run'</tt><tt class="py-op">,</tt> </tt>
<a name="L345"></a><tt class="py-lineno">345</tt>  <tt class="py-line">            <tt id="link-178" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-178', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'scheduler_task'</tt><tt class="py-op">,</tt><tt class="py-string">'reference scheduler_task'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L346"></a><tt class="py-lineno">346</tt>  <tt class="py-line">            <tt id="link-179" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-179', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'status'</tt><tt class="py-op">,</tt><tt id="link-180" class="py-name"><a title="web2py.gluon.tools.Auth.requires" class="py-name" href="#" onclick="return doclink('link-180', 'requires', 'link-142');">requires</a></tt><tt class="py-op">=</tt><tt id="link-181" class="py-name"><a title="web2py.gluon.validators.IS_IN_SET" class="py-name" href="#" onclick="return doclink('link-181', 'IS_IN_SET', 'link-10');">IS_IN_SET</a></tt><tt class="py-op">(</tt><tt id="link-182" class="py-name"><a title="web2py.gluon.scheduler.RUN_STATUS" class="py-name" href="#" onclick="return doclink('link-182', 'RUN_STATUS', 'link-107');">RUN_STATUS</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L347"></a><tt class="py-lineno">347</tt>  <tt class="py-line">            <tt id="link-183" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-183', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'start_time'</tt><tt class="py-op">,</tt><tt class="py-string">'datetime'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L348"></a><tt class="py-lineno">348</tt>  <tt class="py-line">            <tt id="link-184" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-184', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'stop_time'</tt><tt class="py-op">,</tt><tt class="py-string">'datetime'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L349"></a><tt class="py-lineno">349</tt>  <tt class="py-line">            <tt id="link-185" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-185', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'output'</tt><tt class="py-op">,</tt><tt class="py-string">'text'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L350"></a><tt class="py-lineno">350</tt>  <tt class="py-line">            <tt id="link-186" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-186', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'result'</tt><tt class="py-op">,</tt><tt class="py-string">'text'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L351"></a><tt class="py-lineno">351</tt>  <tt class="py-line">            <tt id="link-187" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-187', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'traceback'</tt><tt class="py-op">,</tt><tt class="py-string">'text'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L352"></a><tt class="py-lineno">352</tt>  <tt class="py-line">            <tt id="link-188" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-188', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'worker_name'</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">worker_name</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L353"></a><tt class="py-lineno">353</tt>  <tt class="py-line">            <tt class="py-name">migrate</tt><tt class="py-op">=</tt><tt class="py-name">migrate</tt><tt class="py-op">)</tt> </tt>
<a name="L354"></a><tt class="py-lineno">354</tt>  <tt class="py-line"> </tt>
<a name="L355"></a><tt class="py-lineno">355</tt>  <tt class="py-line">        <tt class="py-name">db</tt><tt class="py-op">.</tt><tt id="link-189" class="py-name"><a title="web2py.gluon.dal.DAL.define_table" class="py-name" href="#" onclick="return doclink('link-189', 'define_table', 'link-140');">define_table</a></tt><tt class="py-op">(</tt> </tt>
<a name="L356"></a><tt class="py-lineno">356</tt>  <tt class="py-line">            <tt class="py-string">'scheduler_worker'</tt><tt class="py-op">,</tt> </tt>
<a name="L357"></a><tt class="py-lineno">357</tt>  <tt class="py-line">            <tt id="link-190" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-190', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'worker_name'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L358"></a><tt class="py-lineno">358</tt>  <tt class="py-line">            <tt id="link-191" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-191', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'first_heartbeat'</tt><tt class="py-op">,</tt><tt class="py-string">'datetime'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L359"></a><tt class="py-lineno">359</tt>  <tt class="py-line">            <tt id="link-192" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-192', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'last_heartbeat'</tt><tt class="py-op">,</tt><tt class="py-string">'datetime'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L360"></a><tt class="py-lineno">360</tt>  <tt class="py-line">            <tt id="link-193" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-193', 'Field', 'link-8');">Field</a></tt><tt class="py-op">(</tt><tt class="py-string">'status'</tt><tt class="py-op">,</tt><tt id="link-194" class="py-name"><a title="web2py.gluon.tools.Auth.requires" class="py-name" href="#" onclick="return doclink('link-194', 'requires', 'link-142');">requires</a></tt><tt class="py-op">=</tt><tt id="link-195" class="py-name"><a title="web2py.gluon.validators.IS_IN_SET" class="py-name" href="#" onclick="return doclink('link-195', 'IS_IN_SET', 'link-10');">IS_IN_SET</a></tt><tt class="py-op">(</tt><tt id="link-196" class="py-name"><a title="web2py.gluon.scheduler.WORKER_STATUS" class="py-name" href="#" onclick="return doclink('link-196', 'WORKER_STATUS', 'link-113');">WORKER_STATUS</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L361"></a><tt class="py-lineno">361</tt>  <tt class="py-line">            <tt class="py-name">migrate</tt><tt class="py-op">=</tt><tt class="py-name">migrate</tt><tt class="py-op">)</tt> </tt>
<a name="L362"></a><tt class="py-lineno">362</tt>  <tt class="py-line">        <tt class="py-name">db</tt><tt class="py-op">.</tt><tt id="link-197" class="py-name" targets="Method web2py.gluon.dal.BaseAdapter.commit()=web2py.gluon.dal.BaseAdapter-class.html#commit,Method web2py.gluon.dal.DAL.commit()=web2py.gluon.dal.DAL-class.html#commit,Method web2py.gluon.dal.NoSQLAdapter.commit()=web2py.gluon.dal.NoSQLAdapter-class.html#commit"><a title="web2py.gluon.dal.BaseAdapter.commit
web2py.gluon.dal.DAL.commit
web2py.gluon.dal.NoSQLAdapter.commit" class="py-name" href="#" onclick="return doclink('link-197', 'commit', 'link-197');">commit</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L363"></a><tt class="py-lineno">363</tt>  <tt class="py-line"> </tt>
<a name="Scheduler.loop"></a><div id="Scheduler.loop-def"><a name="L364"></a><tt class="py-lineno">364</tt> <a class="py-toggle" href="#" id="Scheduler.loop-toggle" onclick="return toggle('Scheduler.loop');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.Scheduler-class.html#loop">loop</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">worker_name</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Scheduler.loop-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Scheduler.loop-expanded"><a name="L365"></a><tt class="py-lineno">365</tt>  <tt class="py-line">        <tt id="link-198" class="py-name"><a title="web2py.gluon.scheduler.MetaScheduler" class="py-name" href="#" onclick="return doclink('link-198', 'MetaScheduler', 'link-127');">MetaScheduler</a></tt><tt class="py-op">.</tt><tt id="link-199" class="py-name" targets="Method web2py.gluon.scheduler.MetaScheduler.loop()=web2py.gluon.scheduler.MetaScheduler-class.html#loop,Method web2py.gluon.scheduler.Scheduler.loop()=web2py.gluon.scheduler.Scheduler-class.html#loop"><a title="web2py.gluon.scheduler.MetaScheduler.loop
web2py.gluon.scheduler.Scheduler.loop" class="py-name" href="#" onclick="return doclink('link-199', 'loop', 'link-199');">loop</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
</div><a name="L366"></a><tt class="py-lineno">366</tt>  <tt class="py-line"> </tt>
<a name="Scheduler.pop_task"></a><div id="Scheduler.pop_task-def"><a name="L367"></a><tt class="py-lineno">367</tt> <a class="py-toggle" href="#" id="Scheduler.pop_task-toggle" onclick="return toggle('Scheduler.pop_task');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.Scheduler-class.html#pop_task">pop_task</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Scheduler.pop_task-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Scheduler.pop_task-expanded"><a name="L368"></a><tt class="py-lineno">368</tt>  <tt class="py-line">        <tt class="py-name">now</tt> <tt class="py-op">=</tt> <tt id="link-200" class="py-name"><a title="datetime.datetime" class="py-name" href="#" onclick="return doclink('link-200', 'datetime', 'link-3');">datetime</a></tt><tt class="py-op">.</tt><tt id="link-201" class="py-name"><a title="datetime.datetime" class="py-name" href="#" onclick="return doclink('link-201', 'datetime', 'link-3');">datetime</a></tt><tt class="py-op">.</tt><tt class="py-name">now</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L369"></a><tt class="py-lineno">369</tt>  <tt class="py-line">        <tt class="py-name">db</tt><tt class="py-op">,</tt> <tt class="py-name">ts</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">scheduler_task</tt> </tt>
<a name="L370"></a><tt class="py-lineno">370</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L371"></a><tt class="py-lineno">371</tt>  <tt class="py-line">            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-202" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-202', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">' grabbing all queued tasks'</tt><tt class="py-op">)</tt> </tt>
<a name="L372"></a><tt class="py-lineno">372</tt>  <tt class="py-line">            <tt class="py-name">all_available</tt> <tt class="py-op">=</tt> <tt class="py-name">db</tt><tt class="py-op">(</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt class="py-name">status</tt><tt class="py-op">.</tt><tt id="link-203" class="py-name" targets="Method web2py.gluon.dal.Expression.belongs()=web2py.gluon.dal.Expression-class.html#belongs"><a title="web2py.gluon.dal.Expression.belongs" class="py-name" href="#" onclick="return doclink('link-203', 'belongs', 'link-203');">belongs</a></tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt id="link-204" class="py-name"><a title="web2py.gluon.scheduler.QUEUED" class="py-name" href="#" onclick="return doclink('link-204', 'QUEUED', 'link-14');">QUEUED</a></tt><tt class="py-op">,</tt><tt id="link-205" class="py-name"><a title="web2py.gluon.scheduler.RUNNING" class="py-name" href="#" onclick="return doclink('link-205', 'RUNNING', 'link-16');">RUNNING</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt>\ </tt>
<a name="L373"></a><tt class="py-lineno">373</tt>  <tt class="py-line">                <tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt class="py-name">times_run</tt><tt class="py-op">&lt;</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt class="py-name">repeats</tt><tt class="py-op">)</tt><tt class="py-op">|</tt><tt class="py-op">(</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt class="py-name">repeats</tt><tt class="py-op">==</tt><tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">)</tt>\ </tt>
<a name="L374"></a><tt class="py-lineno">374</tt>  <tt class="py-line">                <tt class="py-op">(</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt id="link-206" class="py-name" targets="Variable web2py.gluon.rocket.Connection.start_time=web2py.gluon.rocket.Connection-class.html#start_time"><a title="web2py.gluon.rocket.Connection.start_time" class="py-name" href="#" onclick="return doclink('link-206', 'start_time', 'link-206');">start_time</a></tt><tt class="py-op">&lt;=</tt><tt class="py-name">now</tt><tt class="py-op">)</tt>\ </tt>
<a name="L375"></a><tt class="py-lineno">375</tt>  <tt class="py-line">                <tt class="py-op">(</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt class="py-name">stop_time</tt><tt class="py-op">&gt;</tt><tt class="py-name">now</tt><tt class="py-op">)</tt>\ </tt>
<a name="L376"></a><tt class="py-lineno">376</tt>  <tt class="py-line">                <tt class="py-op">(</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt class="py-name">next_run_time</tt><tt class="py-op">&lt;=</tt><tt class="py-name">now</tt><tt class="py-op">)</tt>\ </tt>
<a name="L377"></a><tt class="py-lineno">377</tt>  <tt class="py-line">                <tt class="py-op">(</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt class="py-name">enabled</tt><tt class="py-op">==</tt><tt class="py-name">True</tt><tt class="py-op">)</tt>\ </tt>
<a name="L378"></a><tt class="py-lineno">378</tt>  <tt class="py-line">                <tt class="py-op">(</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt class="py-name">group_name</tt><tt class="py-op">.</tt><tt id="link-207" class="py-name"><a title="web2py.gluon.dal.Expression.belongs" class="py-name" href="#" onclick="return doclink('link-207', 'belongs', 'link-203');">belongs</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">group_names</tt><tt class="py-op">)</tt><tt class="py-op">)</tt>\ </tt>
<a name="L379"></a><tt class="py-lineno">379</tt>  <tt class="py-line">                <tt class="py-op">(</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt class="py-name">assigned_worker_name</tt><tt class="py-op">.</tt><tt id="link-208" class="py-name"><a title="web2py.gluon.dal.Expression.belongs" class="py-name" href="#" onclick="return doclink('link-208', 'belongs', 'link-203');">belongs</a></tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-string">''</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">worker_name</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-comment">#None?</tt> </tt>
<a name="L380"></a><tt class="py-lineno">380</tt>  <tt class="py-line">            <tt class="py-name">number_grabbed</tt> <tt class="py-op">=</tt> <tt class="py-name">all_available</tt><tt class="py-op">.</tt><tt id="link-209" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.update
web2py.gluon.dal.CouchDBAdapter.update
web2py.gluon.dal.GoogleDatastoreAdapter.update
web2py.gluon.dal.IMAPAdapter.update
web2py.gluon.dal.MongoDBAdapter.update
web2py.gluon.dal.Set.update
web2py.gluon.dal.Table.update
web2py.gluon.html.DIV.update
web2py.gluon.tools.Crud.update
web2py.gluon.widget.web2pyDialog.update" class="py-name" href="#" onclick="return doclink('link-209', 'update', 'link-28');">update</a></tt><tt class="py-op">(</tt> </tt>
<a name="L381"></a><tt class="py-lineno">381</tt>  <tt class="py-line">                <tt class="py-name">assigned_worker_name</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">worker_name</tt><tt class="py-op">,</tt><tt class="py-name">status</tt><tt class="py-op">=</tt><tt id="link-210" class="py-name"><a title="web2py.gluon.scheduler.ASSIGNED" class="py-name" href="#" onclick="return doclink('link-210', 'ASSIGNED', 'link-15');">ASSIGNED</a></tt><tt class="py-op">)</tt> </tt>
<a name="L382"></a><tt class="py-lineno">382</tt>  <tt class="py-line">            <tt class="py-name">db</tt><tt class="py-op">.</tt><tt id="link-211" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.commit
web2py.gluon.dal.DAL.commit
web2py.gluon.dal.NoSQLAdapter.commit" class="py-name" href="#" onclick="return doclink('link-211', 'commit', 'link-197');">commit</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L383"></a><tt class="py-lineno">383</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L384"></a><tt class="py-lineno">384</tt>  <tt class="py-line">            <tt class="py-name">number_grabbed</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L385"></a><tt class="py-lineno">385</tt>  <tt class="py-line">            <tt class="py-name">db</tt><tt class="py-op">.</tt><tt id="link-212" class="py-name" targets="Method web2py.gluon.dal.BaseAdapter.rollback()=web2py.gluon.dal.BaseAdapter-class.html#rollback,Method web2py.gluon.dal.DAL.rollback()=web2py.gluon.dal.DAL-class.html#rollback,Method web2py.gluon.dal.NoSQLAdapter.rollback()=web2py.gluon.dal.NoSQLAdapter-class.html#rollback"><a title="web2py.gluon.dal.BaseAdapter.rollback
web2py.gluon.dal.DAL.rollback
web2py.gluon.dal.NoSQLAdapter.rollback" class="py-name" href="#" onclick="return doclink('link-212', 'rollback', 'link-212');">rollback</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L386"></a><tt class="py-lineno">386</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">number_grabbed</tt><tt class="py-op">:</tt> </tt>
<a name="L387"></a><tt class="py-lineno">387</tt>  <tt class="py-line">            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-213" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-213', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'  grabbed %s tasks'</tt> <tt class="py-op">%</tt> <tt class="py-name">number_grabbed</tt><tt class="py-op">)</tt> </tt>
<a name="L388"></a><tt class="py-lineno">388</tt>  <tt class="py-line">            <tt class="py-name">grabbed</tt> <tt class="py-op">=</tt> <tt class="py-name">db</tt><tt class="py-op">(</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt class="py-name">assigned_worker_name</tt><tt class="py-op">==</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">worker_name</tt><tt class="py-op">)</tt>\ </tt>
<a name="L389"></a><tt class="py-lineno">389</tt>  <tt class="py-line">                <tt class="py-op">(</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt class="py-name">status</tt><tt class="py-op">==</tt><tt id="link-214" class="py-name"><a title="web2py.gluon.scheduler.ASSIGNED" class="py-name" href="#" onclick="return doclink('link-214', 'ASSIGNED', 'link-15');">ASSIGNED</a></tt><tt class="py-op">)</tt> </tt>
<a name="L390"></a><tt class="py-lineno">390</tt>  <tt class="py-line">            <tt class="py-name">task</tt> <tt class="py-op">=</tt> <tt class="py-name">grabbed</tt><tt class="py-op">.</tt><tt id="link-215" class="py-name" targets="Method web2py.gluon.dal.BaseAdapter.select()=web2py.gluon.dal.BaseAdapter-class.html#select,Method web2py.gluon.dal.CouchDBAdapter.select()=web2py.gluon.dal.CouchDBAdapter-class.html#select,Method web2py.gluon.dal.GoogleDatastoreAdapter.select()=web2py.gluon.dal.GoogleDatastoreAdapter-class.html#select,Method web2py.gluon.dal.IMAPAdapter.select()=web2py.gluon.dal.IMAPAdapter-class.html#select,Method web2py.gluon.dal.MongoDBAdapter.select()=web2py.gluon.dal.MongoDBAdapter-class.html#select,Method web2py.gluon.dal.Set.select()=web2py.gluon.dal.Set-class.html#select,Method web2py.gluon.tools.Crud.select()=web2py.gluon.tools.Crud-class.html#select"><a title="web2py.gluon.dal.BaseAdapter.select
web2py.gluon.dal.CouchDBAdapter.select
web2py.gluon.dal.GoogleDatastoreAdapter.select
web2py.gluon.dal.IMAPAdapter.select
web2py.gluon.dal.MongoDBAdapter.select
web2py.gluon.dal.Set.select
web2py.gluon.tools.Crud.select" class="py-name" href="#" onclick="return doclink('link-215', 'select', 'link-215');">select</a></tt><tt class="py-op">(</tt><tt class="py-name">limitby</tt><tt class="py-op">=</tt><tt class="py-op">(</tt><tt class="py-number">0</tt><tt class="py-op">,</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">orderby</tt><tt class="py-op">=</tt><tt class="py-name">ts</tt><tt class="py-op">.</tt><tt class="py-name">next_run_time</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-216" class="py-name" targets="Method web2py.gluon.dal.Rows.first()=web2py.gluon.dal.Rows-class.html#first"><a title="web2py.gluon.dal.Rows.first" class="py-name" href="#" onclick="return doclink('link-216', 'first', 'link-216');">first</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L391"></a><tt class="py-lineno">391</tt>  <tt class="py-line"> </tt>
<a name="L392"></a><tt class="py-lineno">392</tt>  <tt class="py-line">            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-217" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-217', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'   releasing all but one (running)'</tt><tt class="py-op">)</tt> </tt>
<a name="L393"></a><tt class="py-lineno">393</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">task</tt><tt class="py-op">:</tt> </tt>
<a name="L394"></a><tt class="py-lineno">394</tt>  <tt class="py-line">                <tt class="py-name">task</tt><tt class="py-op">.</tt><tt id="link-218" class="py-name" targets="Function web2py.gluon.dal.update_record()=web2py.gluon.dal-module.html#update_record"><a title="web2py.gluon.dal.update_record" class="py-name" href="#" onclick="return doclink('link-218', 'update_record', 'link-218');">update_record</a></tt><tt class="py-op">(</tt><tt class="py-name">status</tt><tt class="py-op">=</tt><tt id="link-219" class="py-name"><a title="web2py.gluon.scheduler.RUNNING" class="py-name" href="#" onclick="return doclink('link-219', 'RUNNING', 'link-16');">RUNNING</a></tt><tt class="py-op">,</tt><tt class="py-name">last_run_time</tt><tt class="py-op">=</tt><tt class="py-name">now</tt><tt class="py-op">)</tt> </tt>
<a name="L395"></a><tt class="py-lineno">395</tt>  <tt class="py-line">                <tt class="py-name">grabbed</tt><tt class="py-op">.</tt><tt id="link-220" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.update
web2py.gluon.dal.CouchDBAdapter.update
web2py.gluon.dal.GoogleDatastoreAdapter.update
web2py.gluon.dal.IMAPAdapter.update
web2py.gluon.dal.MongoDBAdapter.update
web2py.gluon.dal.Set.update
web2py.gluon.dal.Table.update
web2py.gluon.html.DIV.update
web2py.gluon.tools.Crud.update
web2py.gluon.widget.web2pyDialog.update" class="py-name" href="#" onclick="return doclink('link-220', 'update', 'link-28');">update</a></tt><tt class="py-op">(</tt><tt class="py-name">assigned_worker_name</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">,</tt><tt class="py-name">status</tt><tt class="py-op">=</tt><tt id="link-221" class="py-name"><a title="web2py.gluon.scheduler.QUEUED" class="py-name" href="#" onclick="return doclink('link-221', 'QUEUED', 'link-14');">QUEUED</a></tt><tt class="py-op">)</tt> </tt>
<a name="L396"></a><tt class="py-lineno">396</tt>  <tt class="py-line">                <tt class="py-name">db</tt><tt class="py-op">.</tt><tt id="link-222" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.commit
web2py.gluon.dal.DAL.commit
web2py.gluon.dal.NoSQLAdapter.commit" class="py-name" href="#" onclick="return doclink('link-222', 'commit', 'link-197');">commit</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L397"></a><tt class="py-lineno">397</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L398"></a><tt class="py-lineno">398</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt>
<a name="L399"></a><tt class="py-lineno">399</tt>  <tt class="py-line">        <tt class="py-name">next_run_time</tt> <tt class="py-op">=</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">last_run_time</tt> <tt class="py-op">+</tt> <tt id="link-223" class="py-name"><a title="datetime.datetime" class="py-name" href="#" onclick="return doclink('link-223', 'datetime', 'link-3');">datetime</a></tt><tt class="py-op">.</tt><tt class="py-name">timedelta</tt><tt class="py-op">(</tt><tt id="link-224" class="py-name" targets="Method web2py.gluon.dal.Expression.seconds()=web2py.gluon.dal.Expression-class.html#seconds"><a title="web2py.gluon.dal.Expression.seconds" class="py-name" href="#" onclick="return doclink('link-224', 'seconds', 'link-224');">seconds</a></tt><tt class="py-op">=</tt><tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">period</tt><tt class="py-op">)</tt> </tt>
<a name="L400"></a><tt class="py-lineno">400</tt>  <tt class="py-line">        <tt class="py-name">times_run</tt> <tt class="py-op">=</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">times_run</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
<a name="L401"></a><tt class="py-lineno">401</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">times_run</tt> <tt class="py-op">&lt;</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">repeats</tt> <tt class="py-keyword">or</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">repeats</tt><tt class="py-op">==</tt><tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L402"></a><tt class="py-lineno">402</tt>  <tt class="py-line">            <tt class="py-name">run_again</tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt> </tt>
<a name="L403"></a><tt class="py-lineno">403</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L404"></a><tt class="py-lineno">404</tt>  <tt class="py-line">            <tt class="py-name">run_again</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L405"></a><tt class="py-lineno">405</tt>  <tt class="py-line">        <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-225" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-225', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'    new scheduler_run record'</tt><tt class="py-op">)</tt> </tt>
<a name="L406"></a><tt class="py-lineno">406</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">True</tt><tt class="py-op">:</tt> </tt>
<a name="L407"></a><tt class="py-lineno">407</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L408"></a><tt class="py-lineno">408</tt>  <tt class="py-line">                <tt class="py-name">run_id</tt> <tt class="py-op">=</tt> <tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">scheduler_run</tt><tt class="py-op">.</tt><tt id="link-226" class="py-name" targets="Method web2py.gluon.dal.BaseAdapter.insert()=web2py.gluon.dal.BaseAdapter-class.html#insert,Method web2py.gluon.dal.CouchDBAdapter.insert()=web2py.gluon.dal.CouchDBAdapter-class.html#insert,Method web2py.gluon.dal.GoogleDatastoreAdapter.insert()=web2py.gluon.dal.GoogleDatastoreAdapter-class.html#insert,Method web2py.gluon.dal.MongoDBAdapter.insert()=web2py.gluon.dal.MongoDBAdapter-class.html#insert,Method web2py.gluon.dal.Table.insert()=web2py.gluon.dal.Table-class.html#insert,Method web2py.gluon.html.DIV.insert()=web2py.gluon.html.DIV-class.html#insert,Method web2py.gluon.template.Content.insert()=web2py.gluon.template.Content-class.html#insert"><a title="web2py.gluon.dal.BaseAdapter.insert
web2py.gluon.dal.CouchDBAdapter.insert
web2py.gluon.dal.GoogleDatastoreAdapter.insert
web2py.gluon.dal.MongoDBAdapter.insert
web2py.gluon.dal.Table.insert
web2py.gluon.html.DIV.insert
web2py.gluon.template.Content.insert" class="py-name" href="#" onclick="return doclink('link-226', 'insert', 'link-226');">insert</a></tt><tt class="py-op">(</tt> </tt>
<a name="L409"></a><tt class="py-lineno">409</tt>  <tt class="py-line">                    <tt class="py-name">scheduler_task</tt> <tt class="py-op">=</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">id</tt><tt class="py-op">,</tt> </tt>
<a name="L410"></a><tt class="py-lineno">410</tt>  <tt class="py-line">                    <tt class="py-name">status</tt><tt class="py-op">=</tt><tt id="link-227" class="py-name"><a title="web2py.gluon.scheduler.RUNNING" class="py-name" href="#" onclick="return doclink('link-227', 'RUNNING', 'link-16');">RUNNING</a></tt><tt class="py-op">,</tt> </tt>
<a name="L411"></a><tt class="py-lineno">411</tt>  <tt class="py-line">                    <tt id="link-228" class="py-name"><a title="web2py.gluon.rocket.Connection.start_time" class="py-name" href="#" onclick="return doclink('link-228', 'start_time', 'link-206');">start_time</a></tt><tt class="py-op">=</tt><tt class="py-name">now</tt><tt class="py-op">,</tt> </tt>
<a name="L412"></a><tt class="py-lineno">412</tt>  <tt class="py-line">                    <tt class="py-name">worker_name</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">worker_name</tt><tt class="py-op">)</tt> </tt>
<a name="L413"></a><tt class="py-lineno">413</tt>  <tt class="py-line">                <tt class="py-name">db</tt><tt class="py-op">.</tt><tt id="link-229" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.commit
web2py.gluon.dal.DAL.commit
web2py.gluon.dal.NoSQLAdapter.commit" class="py-name" href="#" onclick="return doclink('link-229', 'commit', 'link-197');">commit</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L414"></a><tt class="py-lineno">414</tt>  <tt class="py-line">                <tt class="py-keyword">break</tt> </tt>
<a name="L415"></a><tt class="py-lineno">415</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L416"></a><tt class="py-lineno">416</tt>  <tt class="py-line">                <tt class="py-name">db</tt><tt class="py-op">.</tt><tt id="link-230" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.rollback
web2py.gluon.dal.DAL.rollback
web2py.gluon.dal.NoSQLAdapter.rollback" class="py-name" href="#" onclick="return doclink('link-230', 'rollback', 'link-212');">rollback</a></tt> </tt>
<a name="L417"></a><tt class="py-lineno">417</tt>  <tt class="py-line">        <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt class="py-name">info</tt><tt class="py-op">(</tt><tt class="py-string">'new task %(id)s "%(task_name)s" %(application_name)s.%(function_name)s'</tt> <tt class="py-op">%</tt> <tt class="py-name">task</tt><tt class="py-op">)</tt> </tt>
<a name="L418"></a><tt class="py-lineno">418</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt id="link-231" class="py-name"><a title="web2py.gluon.scheduler.Task" class="py-name" href="#" onclick="return doclink('link-231', 'Task', 'link-91');">Task</a></tt><tt class="py-op">(</tt> </tt>
<a name="L419"></a><tt class="py-lineno">419</tt>  <tt class="py-line">            <tt class="py-name">app</tt> <tt class="py-op">=</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">application_name</tt><tt class="py-op">,</tt> </tt>
<a name="L420"></a><tt class="py-lineno">420</tt>  <tt class="py-line">            <tt class="py-name">function</tt> <tt class="py-op">=</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">function_name</tt><tt class="py-op">,</tt> </tt>
<a name="L421"></a><tt class="py-lineno">421</tt>  <tt class="py-line">            <tt class="py-name">timeout</tt> <tt class="py-op">=</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">timeout</tt><tt class="py-op">,</tt> </tt>
<a name="L422"></a><tt class="py-lineno">422</tt>  <tt class="py-line">            <tt class="py-name">args</tt> <tt class="py-op">=</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">args</tt><tt class="py-op">,</tt> <tt class="py-comment">#in json</tt> </tt>
<a name="L423"></a><tt class="py-lineno">423</tt>  <tt class="py-line">            <tt class="py-name">vars</tt> <tt class="py-op">=</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">vars</tt><tt class="py-op">,</tt> <tt class="py-comment">#in json</tt> </tt>
<a name="L424"></a><tt class="py-lineno">424</tt>  <tt class="py-line">            <tt class="py-name">task_id</tt> <tt class="py-op">=</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">id</tt><tt class="py-op">,</tt> </tt>
<a name="L425"></a><tt class="py-lineno">425</tt>  <tt class="py-line">            <tt class="py-name">run_id</tt> <tt class="py-op">=</tt> <tt class="py-name">run_id</tt><tt class="py-op">,</tt> </tt>
<a name="L426"></a><tt class="py-lineno">426</tt>  <tt class="py-line">            <tt class="py-name">run_again</tt> <tt class="py-op">=</tt> <tt class="py-name">run_again</tt><tt class="py-op">,</tt> </tt>
<a name="L427"></a><tt class="py-lineno">427</tt>  <tt class="py-line">            <tt class="py-name">next_run_time</tt><tt class="py-op">=</tt><tt class="py-name">next_run_time</tt><tt class="py-op">,</tt> </tt>
<a name="L428"></a><tt class="py-lineno">428</tt>  <tt class="py-line">            <tt class="py-name">times_run</tt> <tt class="py-op">=</tt> <tt class="py-name">times_run</tt><tt class="py-op">)</tt> </tt>
</div><a name="L429"></a><tt class="py-lineno">429</tt>  <tt class="py-line"> </tt>
<a name="Scheduler.report_task"></a><div id="Scheduler.report_task-def"><a name="L430"></a><tt class="py-lineno">430</tt> <a class="py-toggle" href="#" id="Scheduler.report_task-toggle" onclick="return toggle('Scheduler.report_task');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.Scheduler-class.html#report_task">report_task</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">task</tt><tt class="py-op">,</tt><tt class="py-param">task_report</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Scheduler.report_task-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Scheduler.report_task-expanded"><a name="L431"></a><tt class="py-lineno">431</tt>  <tt class="py-line">        <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-232" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-232', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">' recording task report in db (%s)'</tt> <tt class="py-op">%</tt> <tt class="py-name">task_report</tt><tt class="py-op">.</tt><tt class="py-name">status</tt><tt class="py-op">)</tt> </tt>
<a name="L432"></a><tt class="py-lineno">432</tt>  <tt class="py-line">        <tt class="py-name">db</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt> </tt>
<a name="L433"></a><tt class="py-lineno">433</tt>  <tt class="py-line">        <tt class="py-name">db</tt><tt class="py-op">(</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">scheduler_run</tt><tt class="py-op">.</tt><tt class="py-name">id</tt><tt class="py-op">==</tt><tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">run_id</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-233" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.update
web2py.gluon.dal.CouchDBAdapter.update
web2py.gluon.dal.GoogleDatastoreAdapter.update
web2py.gluon.dal.IMAPAdapter.update
web2py.gluon.dal.MongoDBAdapter.update
web2py.gluon.dal.Set.update
web2py.gluon.dal.Table.update
web2py.gluon.html.DIV.update
web2py.gluon.tools.Crud.update
web2py.gluon.widget.web2pyDialog.update" class="py-name" href="#" onclick="return doclink('link-233', 'update', 'link-28');">update</a></tt><tt class="py-op">(</tt> </tt>
<a name="L434"></a><tt class="py-lineno">434</tt>  <tt class="py-line">            <tt class="py-name">status</tt> <tt class="py-op">=</tt> <tt class="py-name">task_report</tt><tt class="py-op">.</tt><tt class="py-name">status</tt><tt class="py-op">,</tt> </tt>
<a name="L435"></a><tt class="py-lineno">435</tt>  <tt class="py-line">            <tt class="py-name">stop_time</tt> <tt class="py-op">=</tt> <tt id="link-234" class="py-name"><a title="datetime.datetime" class="py-name" href="#" onclick="return doclink('link-234', 'datetime', 'link-3');">datetime</a></tt><tt class="py-op">.</tt><tt id="link-235" class="py-name"><a title="datetime.datetime" class="py-name" href="#" onclick="return doclink('link-235', 'datetime', 'link-3');">datetime</a></tt><tt class="py-op">.</tt><tt class="py-name">now</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L436"></a><tt class="py-lineno">436</tt>  <tt class="py-line">            <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">task_report</tt><tt class="py-op">.</tt><tt class="py-name">result</tt><tt class="py-op">,</tt> </tt>
<a name="L437"></a><tt class="py-lineno">437</tt>  <tt class="py-line">            <tt id="link-236" class="py-name"><a title="web2py.gluon.template.BlockNode.output" class="py-name" href="#" onclick="return doclink('link-236', 'output', 'link-32');">output</a></tt> <tt class="py-op">=</tt> <tt class="py-name">task_report</tt><tt class="py-op">.</tt><tt id="link-237" class="py-name"><a title="web2py.gluon.template.BlockNode.output" class="py-name" href="#" onclick="return doclink('link-237', 'output', 'link-32');">output</a></tt><tt class="py-op">,</tt> </tt>
<a name="L438"></a><tt class="py-lineno">438</tt>  <tt class="py-line">            <tt class="py-name">traceback</tt> <tt class="py-op">=</tt> <tt class="py-name">task_report</tt><tt class="py-op">.</tt><tt class="py-name">tb</tt><tt class="py-op">)</tt> </tt>
<a name="L439"></a><tt class="py-lineno">439</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">task_report</tt><tt class="py-op">.</tt><tt class="py-name">status</tt> <tt class="py-op">==</tt> <tt id="link-238" class="py-name"><a title="web2py.gluon.scheduler.COMPLETED" class="py-name" href="#" onclick="return doclink('link-238', 'COMPLETED', 'link-17');">COMPLETED</a></tt><tt class="py-op">:</tt> </tt>
<a name="L440"></a><tt class="py-lineno">440</tt>  <tt class="py-line">            <tt class="py-name">d</tt> <tt class="py-op">=</tt> <tt class="py-name">dict</tt><tt class="py-op">(</tt><tt class="py-name">status</tt> <tt class="py-op">=</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">run_again</tt> <tt class="py-keyword">and</tt> <tt id="link-239" class="py-name"><a title="web2py.gluon.scheduler.QUEUED" class="py-name" href="#" onclick="return doclink('link-239', 'QUEUED', 'link-14');">QUEUED</a></tt> <tt class="py-keyword">or</tt> <tt id="link-240" class="py-name"><a title="web2py.gluon.scheduler.COMPLETED" class="py-name" href="#" onclick="return doclink('link-240', 'COMPLETED', 'link-17');">COMPLETED</a></tt><tt class="py-op">,</tt> </tt>
<a name="L441"></a><tt class="py-lineno">441</tt>  <tt class="py-line">                     <tt class="py-name">next_run_time</tt> <tt class="py-op">=</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">next_run_time</tt><tt class="py-op">,</tt> </tt>
<a name="L442"></a><tt class="py-lineno">442</tt>  <tt class="py-line">                     <tt class="py-name">times_run</tt> <tt class="py-op">=</tt> <tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">times_run</tt><tt class="py-op">,</tt> </tt>
<a name="L443"></a><tt class="py-lineno">443</tt>  <tt class="py-line">                     <tt class="py-name">assigned_worker_name</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
<a name="L444"></a><tt class="py-lineno">444</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L445"></a><tt class="py-lineno">445</tt>  <tt class="py-line">            <tt class="py-name">d</tt> <tt class="py-op">=</tt> <tt class="py-name">dict</tt><tt class="py-op">(</tt> </tt>
<a name="L446"></a><tt class="py-lineno">446</tt>  <tt class="py-line">                <tt class="py-name">assigned_worker_name</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt><tt class="py-op">,</tt> </tt>
<a name="L447"></a><tt class="py-lineno">447</tt>  <tt class="py-line">                <tt class="py-name">status</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-string">'FAILED'</tt><tt class="py-op">:</tt><tt class="py-string">'FAILED'</tt><tt class="py-op">,</tt> </tt>
<a name="L448"></a><tt class="py-lineno">448</tt>  <tt class="py-line">                          <tt class="py-string">'TIMEOUT'</tt><tt class="py-op">:</tt><tt class="py-string">'TIMEOUT'</tt><tt class="py-op">,</tt> </tt>
<a name="L449"></a><tt class="py-lineno">449</tt>  <tt class="py-line">                          <tt class="py-string">'STOPPED'</tt><tt class="py-op">:</tt><tt class="py-string">'QUEUED'</tt><tt class="py-op">}</tt><tt class="py-op">[</tt><tt class="py-name">task_report</tt><tt class="py-op">.</tt><tt class="py-name">status</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L450"></a><tt class="py-lineno">450</tt>  <tt class="py-line">        <tt class="py-name">db</tt><tt class="py-op">(</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">scheduler_task</tt><tt class="py-op">.</tt><tt class="py-name">id</tt><tt class="py-op">==</tt><tt class="py-name">task</tt><tt class="py-op">.</tt><tt class="py-name">task_id</tt><tt class="py-op">)</tt>\ </tt>
<a name="L451"></a><tt class="py-lineno">451</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">scheduler_task</tt><tt class="py-op">.</tt><tt class="py-name">status</tt><tt class="py-op">==</tt><tt id="link-241" class="py-name"><a title="web2py.gluon.scheduler.RUNNING" class="py-name" href="#" onclick="return doclink('link-241', 'RUNNING', 'link-16');">RUNNING</a></tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-242" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.update
web2py.gluon.dal.CouchDBAdapter.update
web2py.gluon.dal.GoogleDatastoreAdapter.update
web2py.gluon.dal.IMAPAdapter.update
web2py.gluon.dal.MongoDBAdapter.update
web2py.gluon.dal.Set.update
web2py.gluon.dal.Table.update
web2py.gluon.html.DIV.update
web2py.gluon.tools.Crud.update
web2py.gluon.widget.web2pyDialog.update" class="py-name" href="#" onclick="return doclink('link-242', 'update', 'link-28');">update</a></tt><tt class="py-op">(</tt><tt class="py-op">**</tt><tt class="py-name">d</tt><tt class="py-op">)</tt> </tt>
<a name="L452"></a><tt class="py-lineno">452</tt>  <tt class="py-line">        <tt class="py-name">db</tt><tt class="py-op">.</tt><tt id="link-243" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.commit
web2py.gluon.dal.DAL.commit
web2py.gluon.dal.NoSQLAdapter.commit" class="py-name" href="#" onclick="return doclink('link-243', 'commit', 'link-197');">commit</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L453"></a><tt class="py-lineno">453</tt>  <tt class="py-line">        <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt class="py-name">info</tt><tt class="py-op">(</tt><tt class="py-string">'task completed (%s)'</tt> <tt class="py-op">%</tt> <tt class="py-name">task_report</tt><tt class="py-op">.</tt><tt class="py-name">status</tt><tt class="py-op">)</tt> </tt>
</div><a name="L454"></a><tt class="py-lineno">454</tt>  <tt class="py-line"> </tt>
<a name="Scheduler.send_heartbeat"></a><div id="Scheduler.send_heartbeat-def"><a name="L455"></a><tt class="py-lineno">455</tt> <a class="py-toggle" href="#" id="Scheduler.send_heartbeat-toggle" onclick="return toggle('Scheduler.send_heartbeat');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.Scheduler-class.html#send_heartbeat">send_heartbeat</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">counter</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Scheduler.send_heartbeat-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Scheduler.send_heartbeat-expanded"><a name="L456"></a><tt class="py-lineno">456</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db_thread</tt><tt class="py-op">:</tt> </tt>
<a name="L457"></a><tt class="py-lineno">457</tt>  <tt class="py-line">            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-244" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-244', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'thread building own DAL object'</tt><tt class="py-op">)</tt> </tt>
<a name="L458"></a><tt class="py-lineno">458</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db_thread</tt> <tt class="py-op">=</tt> <tt id="link-245" class="py-name"><a title="web2py.gluon.dal.DAL" class="py-name" href="#" onclick="return doclink('link-245', 'DAL', 'link-7');">DAL</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">_uri</tt><tt class="py-op">,</tt><tt class="py-name">folder</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">_adapter</tt><tt class="py-op">.</tt><tt class="py-name">folder</tt><tt class="py-op">)</tt> </tt>
<a name="L459"></a><tt class="py-lineno">459</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-246" class="py-name"><a title="web2py.gluon.dal.IMAPAdapter.define_tables
web2py.gluon.scheduler.Scheduler.define_tables
web2py.gluon.tools.Auth.define_tables" class="py-name" href="#" onclick="return doclink('link-246', 'define_tables', 'link-134');">define_tables</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db_thread</tt><tt class="py-op">,</tt><tt class="py-name">migrate</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt> </tt>
<a name="L460"></a><tt class="py-lineno">460</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L461"></a><tt class="py-lineno">461</tt>  <tt class="py-line">            <tt class="py-name">db</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">db_thread</tt> </tt>
<a name="L462"></a><tt class="py-lineno">462</tt>  <tt class="py-line">            <tt class="py-name">sw</tt><tt class="py-op">,</tt> <tt class="py-name">st</tt> <tt class="py-op">=</tt> <tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">scheduler_worker</tt><tt class="py-op">,</tt> <tt class="py-name">db</tt><tt class="py-op">.</tt><tt class="py-name">scheduler_task</tt> </tt>
<a name="L463"></a><tt class="py-lineno">463</tt>  <tt class="py-line">            <tt class="py-name">now</tt> <tt class="py-op">=</tt> <tt id="link-247" class="py-name"><a title="datetime.datetime" class="py-name" href="#" onclick="return doclink('link-247', 'datetime', 'link-3');">datetime</a></tt><tt class="py-op">.</tt><tt id="link-248" class="py-name"><a title="datetime.datetime" class="py-name" href="#" onclick="return doclink('link-248', 'datetime', 'link-3');">datetime</a></tt><tt class="py-op">.</tt><tt class="py-name">now</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L464"></a><tt class="py-lineno">464</tt>  <tt class="py-line">            <tt class="py-name">expiration</tt> <tt class="py-op">=</tt> <tt class="py-name">now</tt><tt class="py-op">-</tt><tt id="link-249" class="py-name"><a title="datetime.datetime" class="py-name" href="#" onclick="return doclink('link-249', 'datetime', 'link-3');">datetime</a></tt><tt class="py-op">.</tt><tt class="py-name">timedelta</tt><tt class="py-op">(</tt><tt id="link-250" class="py-name"><a title="web2py.gluon.dal.Expression.seconds" class="py-name" href="#" onclick="return doclink('link-250', 'seconds', 'link-224');">seconds</a></tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">heartbeat</tt><tt class="py-op">*</tt><tt class="py-number">3</tt><tt class="py-op">)</tt> </tt>
<a name="L465"></a><tt class="py-lineno">465</tt>  <tt class="py-line">            <tt class="py-comment"># record heartbeat</tt> </tt>
<a name="L466"></a><tt class="py-lineno">466</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-251" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-251', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'........recording heartbeat'</tt><tt class="py-op">)</tt> </tt>
<a name="L467"></a><tt class="py-lineno">467</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">db</tt><tt class="py-op">(</tt><tt class="py-name">sw</tt><tt class="py-op">.</tt><tt class="py-name">worker_name</tt><tt class="py-op">==</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">worker_name</tt><tt class="py-op">)</tt>\ </tt>
<a name="L468"></a><tt class="py-lineno">468</tt>  <tt class="py-line">                    <tt class="py-op">.</tt><tt id="link-252" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.update
web2py.gluon.dal.CouchDBAdapter.update
web2py.gluon.dal.GoogleDatastoreAdapter.update
web2py.gluon.dal.IMAPAdapter.update
web2py.gluon.dal.MongoDBAdapter.update
web2py.gluon.dal.Set.update
web2py.gluon.dal.Table.update
web2py.gluon.html.DIV.update
web2py.gluon.tools.Crud.update
web2py.gluon.widget.web2pyDialog.update" class="py-name" href="#" onclick="return doclink('link-252', 'update', 'link-28');">update</a></tt><tt class="py-op">(</tt><tt class="py-name">last_heartbeat</tt> <tt class="py-op">=</tt> <tt class="py-name">now</tt><tt class="py-op">,</tt> <tt class="py-name">status</tt> <tt class="py-op">=</tt> <tt id="link-253" class="py-name"><a title="web2py.gluon.scheduler.ACTIVE" class="py-name" href="#" onclick="return doclink('link-253', 'ACTIVE', 'link-21');">ACTIVE</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L469"></a><tt class="py-lineno">469</tt>  <tt class="py-line">                <tt class="py-name">sw</tt><tt class="py-op">.</tt><tt id="link-254" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.insert
web2py.gluon.dal.CouchDBAdapter.insert
web2py.gluon.dal.GoogleDatastoreAdapter.insert
web2py.gluon.dal.MongoDBAdapter.insert
web2py.gluon.dal.Table.insert
web2py.gluon.html.DIV.insert
web2py.gluon.template.Content.insert" class="py-name" href="#" onclick="return doclink('link-254', 'insert', 'link-226');">insert</a></tt><tt class="py-op">(</tt><tt class="py-name">status</tt> <tt class="py-op">=</tt> <tt id="link-255" class="py-name"><a title="web2py.gluon.scheduler.ACTIVE" class="py-name" href="#" onclick="return doclink('link-255', 'ACTIVE', 'link-21');">ACTIVE</a></tt><tt class="py-op">,</tt><tt class="py-name">worker_name</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">worker_name</tt><tt class="py-op">,</tt> </tt>
<a name="L470"></a><tt class="py-lineno">470</tt>  <tt class="py-line">                          <tt class="py-name">first_heartbeat</tt> <tt class="py-op">=</tt> <tt class="py-name">now</tt><tt class="py-op">,</tt><tt class="py-name">last_heartbeat</tt> <tt class="py-op">=</tt> <tt class="py-name">now</tt><tt class="py-op">)</tt> </tt>
<a name="L471"></a><tt class="py-lineno">471</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">counter</tt> <tt class="py-op">%</tt> <tt class="py-number">10</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L472"></a><tt class="py-lineno">472</tt>  <tt class="py-line">                <tt class="py-comment"># deallocate jobs assigned to inactive workers and requeue them</tt> </tt>
<a name="L473"></a><tt class="py-lineno">473</tt>  <tt class="py-line"><tt class="py-comment"></tt>                <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-256" class="py-name"><a title="web2py.gluon.debug" class="py-name" href="#" onclick="return doclink('link-256', 'debug', 'link-27');">debug</a></tt><tt class="py-op">(</tt><tt class="py-string">'    freeing workers that have not sent heartbeat'</tt><tt class="py-op">)</tt> </tt>
<a name="L474"></a><tt class="py-lineno">474</tt>  <tt class="py-line">                <tt class="py-name">inactive_workers</tt> <tt class="py-op">=</tt> <tt class="py-name">db</tt><tt class="py-op">(</tt><tt class="py-name">sw</tt><tt class="py-op">.</tt><tt class="py-name">last_heartbeat</tt><tt class="py-op">&lt;</tt><tt class="py-name">expiration</tt><tt class="py-op">)</tt> </tt>
<a name="L475"></a><tt class="py-lineno">475</tt>  <tt class="py-line">                <tt class="py-name">db</tt><tt class="py-op">(</tt><tt class="py-name">st</tt><tt class="py-op">.</tt><tt class="py-name">assigned_worker_name</tt><tt class="py-op">.</tt><tt id="link-257" class="py-name"><a title="web2py.gluon.dal.Expression.belongs" class="py-name" href="#" onclick="return doclink('link-257', 'belongs', 'link-203');">belongs</a></tt><tt class="py-op">(</tt> </tt>
<a name="L476"></a><tt class="py-lineno">476</tt>  <tt class="py-line">                        <tt class="py-name">inactive_workers</tt><tt class="py-op">.</tt><tt id="link-258" class="py-name" targets="Method web2py.gluon.dal.BaseAdapter._select()=web2py.gluon.dal.BaseAdapter-class.html#_select,Method web2py.gluon.dal.CouchDBAdapter._select()=web2py.gluon.dal.CouchDBAdapter-class.html#_select,Method web2py.gluon.dal.IMAPAdapter._select()=web2py.gluon.dal.IMAPAdapter-class.html#_select,Method web2py.gluon.dal.MongoDBAdapter._select()=web2py.gluon.dal.MongoDBAdapter-class.html#_select,Method web2py.gluon.dal.NoSQLAdapter._select()=web2py.gluon.dal.NoSQLAdapter-class.html#_select,Method web2py.gluon.dal.SQLiteAdapter._select()=web2py.gluon.dal.SQLiteAdapter-class.html#_select,Method web2py.gluon.dal.Set._select()=web2py.gluon.dal.Set-class.html#_select"><a title="web2py.gluon.dal.BaseAdapter._select
web2py.gluon.dal.CouchDBAdapter._select
web2py.gluon.dal.IMAPAdapter._select
web2py.gluon.dal.MongoDBAdapter._select
web2py.gluon.dal.NoSQLAdapter._select
web2py.gluon.dal.SQLiteAdapter._select
web2py.gluon.dal.Set._select" class="py-name" href="#" onclick="return doclink('link-258', '_select', 'link-258');">_select</a></tt><tt class="py-op">(</tt><tt class="py-name">sw</tt><tt class="py-op">.</tt><tt class="py-name">worker_name</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt>\ </tt>
<a name="L477"></a><tt class="py-lineno">477</tt>  <tt class="py-line">                        <tt class="py-op">(</tt><tt class="py-name">st</tt><tt class="py-op">.</tt><tt class="py-name">status</tt><tt class="py-op">.</tt><tt id="link-259" class="py-name"><a title="web2py.gluon.dal.Expression.belongs" class="py-name" href="#" onclick="return doclink('link-259', 'belongs', 'link-203');">belongs</a></tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt id="link-260" class="py-name"><a title="web2py.gluon.scheduler.RUNNING" class="py-name" href="#" onclick="return doclink('link-260', 'RUNNING', 'link-16');">RUNNING</a></tt><tt class="py-op">,</tt><tt id="link-261" class="py-name"><a title="web2py.gluon.scheduler.ASSIGNED" class="py-name" href="#" onclick="return doclink('link-261', 'ASSIGNED', 'link-15');">ASSIGNED</a></tt><tt class="py-op">,</tt><tt id="link-262" class="py-name"><a title="web2py.gluon.scheduler.QUEUED" class="py-name" href="#" onclick="return doclink('link-262', 'QUEUED', 'link-14');">QUEUED</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt>\ </tt>
<a name="L478"></a><tt class="py-lineno">478</tt>  <tt class="py-line">                        <tt class="py-op">.</tt><tt id="link-263" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.update
web2py.gluon.dal.CouchDBAdapter.update
web2py.gluon.dal.GoogleDatastoreAdapter.update
web2py.gluon.dal.IMAPAdapter.update
web2py.gluon.dal.MongoDBAdapter.update
web2py.gluon.dal.Set.update
web2py.gluon.dal.Table.update
web2py.gluon.html.DIV.update
web2py.gluon.tools.Crud.update
web2py.gluon.widget.web2pyDialog.update" class="py-name" href="#" onclick="return doclink('link-263', 'update', 'link-28');">update</a></tt><tt class="py-op">(</tt><tt class="py-name">assigned_worker_name</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">,</tt><tt class="py-name">status</tt><tt class="py-op">=</tt><tt id="link-264" class="py-name"><a title="web2py.gluon.scheduler.QUEUED" class="py-name" href="#" onclick="return doclink('link-264', 'QUEUED', 'link-14');">QUEUED</a></tt><tt class="py-op">)</tt> </tt>
<a name="L479"></a><tt class="py-lineno">479</tt>  <tt class="py-line">                <tt class="py-name">inactive_workers</tt><tt class="py-op">.</tt><tt id="link-265" class="py-name" targets="Method web2py.gluon.dal.BaseAdapter.delete()=web2py.gluon.dal.BaseAdapter-class.html#delete,Method web2py.gluon.dal.CouchDBAdapter.delete()=web2py.gluon.dal.CouchDBAdapter-class.html#delete,Method web2py.gluon.dal.GoogleDatastoreAdapter.delete()=web2py.gluon.dal.GoogleDatastoreAdapter-class.html#delete,Method web2py.gluon.dal.IMAPAdapter.delete()=web2py.gluon.dal.IMAPAdapter-class.html#delete,Method web2py.gluon.dal.Set.delete()=web2py.gluon.dal.Set-class.html#delete,Method web2py.gluon.tools.Crud.delete()=web2py.gluon.tools.Crud-class.html#delete"><a title="web2py.gluon.dal.BaseAdapter.delete
web2py.gluon.dal.CouchDBAdapter.delete
web2py.gluon.dal.GoogleDatastoreAdapter.delete
web2py.gluon.dal.IMAPAdapter.delete
web2py.gluon.dal.Set.delete
web2py.gluon.tools.Crud.delete" class="py-name" href="#" onclick="return doclink('link-265', 'delete', 'link-265');">delete</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L480"></a><tt class="py-lineno">480</tt>  <tt class="py-line">            <tt class="py-name">db</tt><tt class="py-op">.</tt><tt id="link-266" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.commit
web2py.gluon.dal.DAL.commit
web2py.gluon.dal.NoSQLAdapter.commit" class="py-name" href="#" onclick="return doclink('link-266', 'commit', 'link-197');">commit</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L481"></a><tt class="py-lineno">481</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L482"></a><tt class="py-lineno">482</tt>  <tt class="py-line">            <tt class="py-name">db</tt><tt class="py-op">.</tt><tt id="link-267" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.rollback
web2py.gluon.dal.DAL.rollback
web2py.gluon.dal.NoSQLAdapter.rollback" class="py-name" href="#" onclick="return doclink('link-267', 'rollback', 'link-212');">rollback</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L483"></a><tt class="py-lineno">483</tt>  <tt class="py-line">        <tt id="link-268" class="py-name"><a title="datetime.time" class="py-name" href="#" onclick="return doclink('link-268', 'time', 'link-1');">time</a></tt><tt class="py-op">.</tt><tt id="link-269" class="py-name"><a title="web2py.gluon.scheduler.MetaScheduler.sleep
web2py.gluon.scheduler.Scheduler.sleep" class="py-name" href="#" onclick="return doclink('link-269', 'sleep', 'link-35');">sleep</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">heartbeat</tt><tt class="py-op">)</tt> </tt>
</div><a name="L484"></a><tt class="py-lineno">484</tt>  <tt class="py-line"> </tt>
<a name="Scheduler.sleep"></a><div id="Scheduler.sleep-def"><a name="L485"></a><tt class="py-lineno">485</tt> <a class="py-toggle" href="#" id="Scheduler.sleep-toggle" onclick="return toggle('Scheduler.sleep');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler.Scheduler-class.html#sleep">sleep</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Scheduler.sleep-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Scheduler.sleep-expanded"><a name="L486"></a><tt class="py-lineno">486</tt>  <tt class="py-line">        <tt id="link-270" class="py-name"><a title="datetime.time" class="py-name" href="#" onclick="return doclink('link-270', 'time', 'link-1');">time</a></tt><tt class="py-op">.</tt><tt id="link-271" class="py-name"><a title="web2py.gluon.scheduler.MetaScheduler.sleep
web2py.gluon.scheduler.Scheduler.sleep" class="py-name" href="#" onclick="return doclink('link-271', 'sleep', 'link-35');">sleep</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">heartbeat</tt><tt class="py-op">)</tt> <tt class="py-comment"># should only sleep until next available task</tt> </tt>
</div></div><a name="L487"></a><tt class="py-lineno">487</tt>  <tt class="py-line"> </tt>
<a name="main"></a><div id="main-def"><a name="L488"></a><tt class="py-lineno">488</tt> <a class="py-toggle" href="#" id="main-toggle" onclick="return toggle('main');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.scheduler-module.html#main">main</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="main-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="main-expanded"><a name="L489"></a><tt class="py-lineno">489</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L490"></a><tt class="py-lineno">490</tt>  <tt class="py-line"><tt class="py-docstring">    allows to run worker without python web2py.py .... by simply python this.py</tt> </tt>
<a name="L491"></a><tt class="py-lineno">491</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L492"></a><tt class="py-lineno">492</tt>  <tt class="py-line">    <tt class="py-name">parser</tt> <tt class="py-op">=</tt> <tt class="py-name">optparse</tt><tt class="py-op">.</tt><tt class="py-name">OptionParser</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L493"></a><tt class="py-lineno">493</tt>  <tt class="py-line">    <tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt> </tt>
<a name="L494"></a><tt class="py-lineno">494</tt>  <tt class="py-line">        <tt class="py-string">"-w"</tt><tt class="py-op">,</tt> <tt class="py-string">"--worker_name"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"worker_name"</tt><tt class="py-op">,</tt> <tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> </tt>
<a name="L495"></a><tt class="py-lineno">495</tt>  <tt class="py-line">        <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"start a worker with name"</tt><tt class="py-op">)</tt> </tt>
<a name="L496"></a><tt class="py-lineno">496</tt>  <tt class="py-line">    <tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt> </tt>
<a name="L497"></a><tt class="py-lineno">497</tt>  <tt class="py-line">        <tt class="py-string">"-b"</tt><tt class="py-op">,</tt> <tt class="py-string">"--heartbeat"</tt><tt class="py-op">,</tt><tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"heartbeat"</tt><tt class="py-op">,</tt> <tt class="py-name">default</tt> <tt class="py-op">=</tt> <tt class="py-number">10</tt><tt class="py-op">,</tt> </tt>
<a name="L498"></a><tt class="py-lineno">498</tt>  <tt class="py-line">        <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"heartbeat time in seconds (default 10)"</tt><tt class="py-op">)</tt> </tt>
<a name="L499"></a><tt class="py-lineno">499</tt>  <tt class="py-line">    <tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt> </tt>
<a name="L500"></a><tt class="py-lineno">500</tt>  <tt class="py-line">        <tt class="py-string">"-L"</tt><tt class="py-op">,</tt> <tt class="py-string">"--logger_level"</tt><tt class="py-op">,</tt><tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"logger_level"</tt><tt class="py-op">,</tt> </tt>
<a name="L501"></a><tt class="py-lineno">501</tt>  <tt class="py-line">        <tt class="py-name">default</tt> <tt class="py-op">=</tt> <tt class="py-string">'INFO'</tt><tt class="py-op">,</tt> </tt>
<a name="L502"></a><tt class="py-lineno">502</tt>  <tt class="py-line">        <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"level of logging (DEBUG, INFO, WARNING, ERROR)"</tt><tt class="py-op">)</tt> </tt>
<a name="L503"></a><tt class="py-lineno">503</tt>  <tt class="py-line">    <tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt> </tt>
<a name="L504"></a><tt class="py-lineno">504</tt>  <tt class="py-line">        <tt class="py-string">"-g"</tt><tt class="py-op">,</tt> <tt class="py-string">"--group_names"</tt><tt class="py-op">,</tt><tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"group_names"</tt><tt class="py-op">,</tt> </tt>
<a name="L505"></a><tt class="py-lineno">505</tt>  <tt class="py-line">        <tt class="py-name">default</tt> <tt class="py-op">=</tt> <tt class="py-string">'main'</tt><tt class="py-op">,</tt> </tt>
<a name="L506"></a><tt class="py-lineno">506</tt>  <tt class="py-line">        <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"comma separated list of groups to be picked by the worker"</tt><tt class="py-op">)</tt> </tt>
<a name="L507"></a><tt class="py-lineno">507</tt>  <tt class="py-line">    <tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt> </tt>
<a name="L508"></a><tt class="py-lineno">508</tt>  <tt class="py-line">        <tt class="py-string">"-f"</tt><tt class="py-op">,</tt> <tt class="py-string">"--db_folder"</tt><tt class="py-op">,</tt><tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"db_folder"</tt><tt class="py-op">,</tt> </tt>
<a name="L509"></a><tt class="py-lineno">509</tt>  <tt class="py-line">        <tt class="py-name">default</tt> <tt class="py-op">=</tt> <tt class="py-string">'/Users/mdipierro/web2py/applications/scheduler/databases'</tt><tt class="py-op">,</tt> </tt>
<a name="L510"></a><tt class="py-lineno">510</tt>  <tt class="py-line">        <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"location of the dal database folder"</tt><tt class="py-op">)</tt> </tt>
<a name="L511"></a><tt class="py-lineno">511</tt>  <tt class="py-line">    <tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt> </tt>
<a name="L512"></a><tt class="py-lineno">512</tt>  <tt class="py-line">        <tt class="py-string">"-u"</tt><tt class="py-op">,</tt> <tt class="py-string">"--db_uri"</tt><tt class="py-op">,</tt><tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"db_uri"</tt><tt class="py-op">,</tt> </tt>
<a name="L513"></a><tt class="py-lineno">513</tt>  <tt class="py-line">        <tt class="py-name">default</tt> <tt class="py-op">=</tt> <tt class="py-string">'sqlite://storage.sqlite'</tt><tt class="py-op">,</tt> </tt>
<a name="L514"></a><tt class="py-lineno">514</tt>  <tt class="py-line">        <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"database URI string (web2py DAL syntax)"</tt><tt class="py-op">)</tt> </tt>
<a name="L515"></a><tt class="py-lineno">515</tt>  <tt class="py-line">    <tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt> </tt>
<a name="L516"></a><tt class="py-lineno">516</tt>  <tt class="py-line">        <tt class="py-string">"-t"</tt><tt class="py-op">,</tt> <tt class="py-string">"--tasks"</tt><tt class="py-op">,</tt><tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"tasks"</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> </tt>
<a name="L517"></a><tt class="py-lineno">517</tt>  <tt class="py-line">        <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"file containing task files, must define"</tt> <tt class="py-op">+</tt> \ </tt>
<a name="L518"></a><tt class="py-lineno">518</tt>  <tt class="py-line">            <tt class="py-string">"tasks = {'task_name':(lambda: 'output')} or similar set of tasks"</tt><tt class="py-op">)</tt> </tt>
<a name="L519"></a><tt class="py-lineno">519</tt>  <tt class="py-line">    <tt class="py-op">(</tt><tt id="link-272" class="py-name" targets="Method web2py.gluon.validators.IS_IN_DB.options()=web2py.gluon.validators.IS_IN_DB-class.html#options,Method web2py.gluon.validators.IS_IN_SET.options()=web2py.gluon.validators.IS_IN_SET-class.html#options"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-272', 'options', 'link-272');">options</a></tt><tt class="py-op">,</tt> <tt class="py-name">args</tt><tt class="py-op">)</tt> <tt class="py-op">=</tt> <tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">parse_args</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L520"></a><tt class="py-lineno">520</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt id="link-273" class="py-name"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-273', 'options', 'link-272');">options</a></tt><tt class="py-op">.</tt><tt class="py-name">tasks</tt> <tt class="py-keyword">or</tt> <tt class="py-keyword">not</tt> <tt id="link-274" class="py-name"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-274', 'options', 'link-272');">options</a></tt><tt class="py-op">.</tt><tt class="py-name">db_uri</tt><tt class="py-op">:</tt> </tt>
<a name="L521"></a><tt class="py-lineno">521</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt id="link-275" class="py-name"><a title="web2py.gluon.scheduler.USAGE" class="py-name" href="#" onclick="return doclink('link-275', 'USAGE', 'link-0');">USAGE</a></tt> </tt>
<a name="L522"></a><tt class="py-lineno">522</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt id="link-276" class="py-name"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-276', 'options', 'link-272');">options</a></tt><tt class="py-op">.</tt><tt class="py-name">tasks</tt><tt class="py-op">:</tt> </tt>
<a name="L523"></a><tt class="py-lineno">523</tt>  <tt class="py-line">        <tt class="py-name">path</tt><tt class="py-op">,</tt><tt class="py-name">filename</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt id="link-277" class="py-name"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-277', 'options', 'link-272');">options</a></tt><tt class="py-op">.</tt><tt class="py-name">tasks</tt><tt class="py-op">)</tt> </tt>
<a name="L524"></a><tt class="py-lineno">524</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">filename</tt><tt class="py-op">.</tt><tt id="link-278" class="py-name" targets="Method web2py.gluon.dal.Expression.endswith()=web2py.gluon.dal.Expression-class.html#endswith"><a title="web2py.gluon.dal.Expression.endswith" class="py-name" href="#" onclick="return doclink('link-278', 'endswith', 'link-278');">endswith</a></tt><tt class="py-op">(</tt><tt class="py-string">'.py'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L525"></a><tt class="py-lineno">525</tt>  <tt class="py-line">            <tt class="py-name">filename</tt> <tt class="py-op">=</tt> <tt class="py-name">filename</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">3</tt><tt class="py-op">]</tt> </tt>
<a name="L526"></a><tt class="py-lineno">526</tt>  <tt class="py-line">        <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-279" class="py-name"><a title="web2py.gluon.html.DIV.append
web2py.gluon.template.BlockNode.append
web2py.gluon.template.Content.append" class="py-name" href="#" onclick="return doclink('link-279', 'append', 'link-5');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">)</tt> </tt>
<a name="L527"></a><tt class="py-lineno">527</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-string">'importing tasks...'</tt> </tt>
<a name="L528"></a><tt class="py-lineno">528</tt>  <tt class="py-line">        <tt class="py-name">tasks</tt> <tt class="py-op">=</tt> <tt class="py-name">__import__</tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt> <tt id="link-280" class="py-name"><a title="web2py.gluon.globals" class="py-name" href="#" onclick="return doclink('link-280', 'globals', 'link-56');">globals</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">tasks</tt> </tt>
<a name="L529"></a><tt class="py-lineno">529</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-string">'tasks found: '</tt><tt class="py-op">+</tt><tt class="py-string">', '</tt><tt class="py-op">.</tt><tt id="link-281" class="py-name"><a title="web2py.gluon.html.join
web2py.gluon.rocket.Listener.join" class="py-name" href="#" onclick="return doclink('link-281', 'join', 'link-71');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">tasks</tt><tt class="py-op">.</tt><tt id="link-282" class="py-name"><a title="web2py.gluon.tools.PluginManager.keys" class="py-name" href="#" onclick="return doclink('link-282', 'keys', 'link-156');">keys</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L530"></a><tt class="py-lineno">530</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L531"></a><tt class="py-lineno">531</tt>  <tt class="py-line">        <tt class="py-name">tasks</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L532"></a><tt class="py-lineno">532</tt>  <tt class="py-line">    <tt class="py-name">group_names</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt id="link-283" class="py-name" targets="Variable sqlite3.dbapi2.x=sqlite3.dbapi2-module.html#x"><a title="sqlite3.dbapi2.x" class="py-name" href="#" onclick="return doclink('link-283', 'x', 'link-283');">x</a></tt><tt class="py-op">.</tt><tt id="link-284" class="py-name" targets="Method web2py.gluon.sanitizer.XssCleaner.strip()=web2py.gluon.sanitizer.XssCleaner-class.html#strip"><a title="web2py.gluon.sanitizer.XssCleaner.strip" class="py-name" href="#" onclick="return doclink('link-284', 'strip', 'link-284');">strip</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt id="link-285" class="py-name"><a title="sqlite3.dbapi2.x" class="py-name" href="#" onclick="return doclink('link-285', 'x', 'link-283');">x</a></tt> <tt class="py-keyword">in</tt> <tt id="link-286" class="py-name"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-286', 'options', 'link-272');">options</a></tt><tt class="py-op">.</tt><tt class="py-name">group_names</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">','</tt><tt class="py-op">)</tt><tt class="py-op">]</tt> </tt>
<a name="L533"></a><tt class="py-lineno">533</tt>  <tt class="py-line"> </tt>
<a name="L534"></a><tt class="py-lineno">534</tt>  <tt class="py-line">    <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt class="py-name">getLogger</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">setLevel</tt><tt class="py-op">(</tt><tt id="link-287" class="py-name"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-287', 'options', 'link-272');">options</a></tt><tt class="py-op">.</tt><tt class="py-name">logger_level</tt><tt class="py-op">)</tt> </tt>
<a name="L535"></a><tt class="py-lineno">535</tt>  <tt class="py-line"> </tt>
<a name="L536"></a><tt class="py-lineno">536</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">'groups for this worker: '</tt><tt class="py-op">+</tt><tt class="py-string">', '</tt><tt class="py-op">.</tt><tt id="link-288" class="py-name"><a title="web2py.gluon.html.join
web2py.gluon.rocket.Listener.join" class="py-name" href="#" onclick="return doclink('link-288', 'join', 'link-71');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">group_names</tt><tt class="py-op">)</tt> </tt>
<a name="L537"></a><tt class="py-lineno">537</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">'connecting to database in folder: '</tt> <tt class="py-op">+</tt> <tt id="link-289" class="py-name"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-289', 'options', 'link-272');">options</a></tt><tt class="py-op">.</tt><tt class="py-name">db_folder</tt> <tt class="py-keyword">or</tt> <tt class="py-string">'./'</tt> </tt>
<a name="L538"></a><tt class="py-lineno">538</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">'using URI: '</tt><tt class="py-op">+</tt><tt id="link-290" class="py-name"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-290', 'options', 'link-272');">options</a></tt><tt class="py-op">.</tt><tt class="py-name">db_uri</tt> </tt>
<a name="L539"></a><tt class="py-lineno">539</tt>  <tt class="py-line">    <tt class="py-name">db</tt> <tt class="py-op">=</tt> <tt id="link-291" class="py-name"><a title="web2py.gluon.dal.DAL" class="py-name" href="#" onclick="return doclink('link-291', 'DAL', 'link-7');">DAL</a></tt><tt class="py-op">(</tt><tt id="link-292" class="py-name"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-292', 'options', 'link-272');">options</a></tt><tt class="py-op">.</tt><tt class="py-name">db_uri</tt><tt class="py-op">,</tt><tt class="py-name">folder</tt><tt class="py-op">=</tt><tt id="link-293" class="py-name"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-293', 'options', 'link-272');">options</a></tt><tt class="py-op">.</tt><tt class="py-name">db_folder</tt><tt class="py-op">)</tt> </tt>
<a name="L540"></a><tt class="py-lineno">540</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">'instantiating scheduler...'</tt> </tt>
<a name="L541"></a><tt class="py-lineno">541</tt>  <tt class="py-line">    <tt id="link-294" class="py-name"><a title="web2py.gluon.scheduler" class="py-name" href="#" onclick="return doclink('link-294', 'scheduler', 'link-53');">scheduler</a></tt><tt class="py-op">=</tt><tt id="link-295" class="py-name" targets="Class web2py.gluon.scheduler.Scheduler=web2py.gluon.scheduler.Scheduler-class.html"><a title="web2py.gluon.scheduler.Scheduler" class="py-name" href="#" onclick="return doclink('link-295', 'Scheduler', 'link-295');">Scheduler</a></tt><tt class="py-op">(</tt><tt class="py-name">db</tt> <tt class="py-op">=</tt> <tt class="py-name">db</tt><tt class="py-op">,</tt> </tt>
<a name="L542"></a><tt class="py-lineno">542</tt>  <tt class="py-line">                        <tt class="py-name">worker_name</tt> <tt class="py-op">=</tt> <tt id="link-296" class="py-name"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-296', 'options', 'link-272');">options</a></tt><tt class="py-op">.</tt><tt class="py-name">worker_name</tt><tt class="py-op">,</tt> </tt>
<a name="L543"></a><tt class="py-lineno">543</tt>  <tt class="py-line">                        <tt class="py-name">tasks</tt> <tt class="py-op">=</tt> <tt class="py-name">tasks</tt><tt class="py-op">,</tt> </tt>
<a name="L544"></a><tt class="py-lineno">544</tt>  <tt class="py-line">                        <tt class="py-name">migrate</tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt><tt class="py-op">,</tt> </tt>
<a name="L545"></a><tt class="py-lineno">545</tt>  <tt class="py-line">                        <tt class="py-name">group_names</tt> <tt class="py-op">=</tt> <tt class="py-name">group_names</tt><tt class="py-op">,</tt> </tt>
<a name="L546"></a><tt class="py-lineno">546</tt>  <tt class="py-line">                        <tt class="py-name">heartbeat</tt> <tt class="py-op">=</tt> <tt id="link-297" class="py-name"><a title="web2py.gluon.validators.IS_IN_DB.options
web2py.gluon.validators.IS_IN_SET.options" class="py-name" href="#" onclick="return doclink('link-297', 'options', 'link-272');">options</a></tt><tt class="py-op">.</tt><tt class="py-name">heartbeat</tt><tt class="py-op">)</tt> </tt>
<a name="L547"></a><tt class="py-lineno">547</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">'starting main worker loop...'</tt> </tt>
<a name="L548"></a><tt class="py-lineno">548</tt>  <tt class="py-line">    <tt id="link-298" class="py-name"><a title="web2py.gluon.scheduler" class="py-name" href="#" onclick="return doclink('link-298', 'scheduler', 'link-53');">scheduler</a></tt><tt class="py-op">.</tt><tt id="link-299" class="py-name"><a title="web2py.gluon.scheduler.MetaScheduler.loop
web2py.gluon.scheduler.Scheduler.loop" class="py-name" href="#" onclick="return doclink('link-299', 'loop', 'link-199');">loop</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L549"></a><tt class="py-lineno">549</tt>  <tt class="py-line"> </tt>
<a name="L550"></a><tt class="py-lineno">550</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt><tt class="py-op">==</tt><tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
<a name="L551"></a><tt class="py-lineno">551</tt>  <tt class="py-line">    <tt id="link-300" class="py-name" targets="Module web2py.gluon.main=web2py.gluon.main-module.html,Function web2py.gluon.scheduler.main()=web2py.gluon.scheduler-module.html#main"><a title="web2py.gluon.main
web2py.gluon.scheduler.main" class="py-name" href="#" onclick="return doclink('link-300', 'main', 'link-300');">main</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L552"></a><tt class="py-lineno">552</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="web2py.gluon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://www.web2py.com">web2py Web Framework</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0beta1 on Sun Mar  4 22:12:06 2012
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
